Reinstalling requirement file using pip - django

I try to reinstall requirements for my project using pip but I get this error. There is a previous failed installation. how can I delete it and proceed ?
E:\projects\project course\tkz>pip install -r requirements.txt
Downloading/unpacking Django==1.5.4 (from -r requirements.txt (line 1))
pip can't proceed with requirement 'Django==1.5.4 (from -r requirements.txt (lin
e 1))' due to a pre-existing build directory.
location: c:\users\sina\appdata\local\temp\pip_build_sina\Django
This is likely due to a previous installation that failed.
pip is being responsible and not assuming it can delete this.
Please delete it and try again.
Cleaning up...

Use:
pip uninstall Django==1.5.4
or
pip uninstall -r requirements.txt
If that still doesn't work, then go into you Python/Lib/site-packages directory where these packages live, and delete them. Then re-run
pip install -r requirements.txt
and that should work.

You can just go ahead and delete that directory, that's what the message is telling you.

Can you try pip install -I django==1.5.4?

You need to delete the whole directory:
cd c:\users\sina\appdata\local\temp\pip_build_sina
rm -R Django
Now you can reinstall Django again

Related

Error of "Command 'pip' not found" when trying to install requirements.txt

I'm trying to do: pip install -r requirements.txt on an AWS server. I recently pulled a git commit.
I get this error:
Command 'pip' not found, but can be installed with:
sudo apt install python-pip
So I tried entering:
sudo apt install python-pip install -r requirements.txt
and then
sudo apt install python-pip -r requirements.txt
But both attempts gave me this error:
E: Command line option 'r' [from -r] is not understood in combination with the other options.
What is the correct command to install this? Thank you.
You are mixing multiple commands.
apt ; It is Debian's package manager. It has nothing to do with python packages. You install pip through apt. There are also other ways of doing it.
pip : As understood it is python package manager. You can install dependencies for your project by listing them in requirements.txt.
The correct way would be :
sudo apt install python-pip
#install from a file requirements.txt:
sudo pip install -r requirements.txt
#install as a user :
pip install -U -r requirements.txt

How to uninstall pycocotools installed via distils

I have a pycocotools version installed using distils in my system. I want to build and install from a different repo that has more recent changes and which has a issue fixed. But I get the following error. Any idea how I can resolve this issue?
(base) root#tf-notebook-nirandi-855bcb7b58-wxsc9:/notebooks/shared-datasets/shared-datasets/demos/mask-r-cnn# pip install -e git+https://github.com/waleedka/coco.git#egg=coco\&subdirectory=PythonAPI
Obtaining coco from git+https://github.com/waleedka/coco.git#egg=coco&subdirectory=PythonAPI
Cloning https://github.com/waleedka/coco.git to ./src/coco
Running command git clone -q https://github.com/waleedka/coco.git /notebooks/shared-datasets/shared-datasets/demos/mask-r-cnn/src/coco
WARNING: Generating metadata for package coco produced metadata for project name pycocotools. Fix your #egg=coco fragments.
Installing collected packages: pycocotools
Found existing installation: pycocotools 2.0
ERROR: Cannot uninstall 'pycocotools'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Here I post the final solution.
Step1: Upgrade your pip.
python -m pip install --upgrade pip
Step2: Locate the path of the installed pycocotools. One simple try is to reinstall pycocotools, and pip will give you the path
pip install pycocotools
You will get
Requirement already satisfied: pycocotools in /home/frank/.local/lib/python3.7/site-packages
Now, we know the pkg is at /home/frank/.local/lib/python3.7/site-packages.
Step3: Delete related files.
cd /home/frank/.local/lib/python3.7/site-packages
rm -rf pycocotools
rm -rf pycocotools-2.0-py3.7.egg-info
Over.
Then you can reinstall the lastest version of pycocotools or just never be bothered by this.

Pip having trying to uninstall appdirs while trying to install requirements.txt when deploying to pythonanywhere

I am trying to deploy my project on pythonanywhere. I have created my virtualenv and activated it but when I try to
"pip install -r requirements.txt"
it says
"Found existing installation: appdirs1.4.2 Uninstalling appdirs-1.4.2:"
and then gets a permission denied error.
What's going on and how do I fix it?
Full error in bpaste: https://bpaste.net/show/a7394c84c672
pip found appdirs-1.4.2 and gonna uninstall it and replace with appdirs-1.4.3 but failed on uninstallation — you don't have write access to /usr/local/lib/python2.7/dist-packages/. Run with sudo:
sudo pip install -r requirements.txt

Setting up django-nonrel using pip

I'm trying to install django-nonrel the correct way - and to be able to reproduce the process.
I've installed django-nonrel using pip - as following:
pip install git+https://github.com/django-nonrel/django-nonrel.git
pip install git+https://github.com/django-nonrel/django-dbindexer.git
pip install git+https://github.com/django-nonrel/django-permission-backend-nonrel
pip install hg+https://bitbucket.org/wkornewald/djangoappengine
pip install hg+https://bitbucket.org/wkornewald/djangotoolbox
pip install hg+https://bitbucket.org/twanschik/django-autoload
pip install hg+https://bitbucket.org/twanschik/nonrel-search/src
After installation, I got this req.txt file (pip freeze > req.txt):
Django==1.3.1
django-autoload==0.01
django-dbindexer==0.3
djangoappengine==1.0
djangotoolbox==0.9.2
nonrel-search==0.1
permission-backend-nonrel==0.1
wsgiref==0.1.2
But I can't use my req.txt file to get the same stuff.
If I uninstall a package (e.g. django-autoload) and try to get it again using the requirements file
(gae-first)bentzy#lama:~/.virtualenvs/gae-first$ pip uninstall django-autoload
Uninstalling django-autoload:
...
Successfully uninstalled django-autoload
(gae-first)bentzy#lama:~/.virtualenvs/gae-first$ pip install -r req.txt
Requirement already satisfied (use --upgrade to upgrade): Django==1.3.1 in ./lib/python2.7/site-packages (from -r req.txt (line 1))
Downloading/unpacking django-autoload==0.01 (from -r req.txt (line 2))
Could not find any downloads that satisfy the requirement django-autoload==0.01 (from -r req.txt (line 2))
No distributions at all found for django-autoload==0.01 (from -r req.txt (line 2))
Storing complete log in /home/bentzy/.pip/pip.log
Why aren't those packages at pip repository?
It still make sense to use pip to install them?
The problem is that your requirements file does not have enough information.
What pip is going to do when you request it to install django-autoload, for instance, is look at PyPI for that package (and scrap some pages after finding the PyPI entry).
If you want to have a requirements file that downloads those packages the same way you did while installing one by one, do the same: tell pip where to find packages.
Create a requirements file like:
git+https://github.com/django-nonrel/django-nonrel.git
git+https://github.com/django-nonrel/django-dbindexer.git
git+https://github.com/django-nonrel/django-permission-backend-nonrel
hg+https://bitbucket.org/wkornewald/djangoappengine
hg+https://bitbucket.org/wkornewald/djangotoolbox
hg+https://bitbucket.org/twanschik/django-autoload
hg+https://bitbucket.org/twanschik/nonrel-search/src
Or if you want to install from specific tag or commit, do:
git+https://github.com/django-nonrel/django-nonrel.git#1.3.1#egg=Django
Read more about requirements file at http://www.pip-installer.org/en/latest/logic.html#requirements-file-format
it doesn't really make sense to use pip if you're using GAE, since all the packages you use need to be in your actual GAE project folder. Packages installed in your system or virtualenv environments won't get uploaded to GAE production servers.

is it possible to install django beta with pip?

I've tried a few variants of
pip install django==1.4b1 -E canvas
in an attempt to install the beta the easy way.
is there a way to do it?
or do i just have to swallow the pain of downloading and unzipping.
pip install svn+http://code.djangoproject.com/svn/django/trunk/#egg=django
github repository:
pip install git+git://github.com/django/django.git#1.5c1
Pip docs: Installing from a VCS
pip install -e svn+http://code.djangoproject.com/svn/django/trunk/#egg=Django