pip missing from bin in virtualenv - python

pip is installing to global location rather than in the venv. I tried a lot of things but none worked. I found out that pip3 is missing from bin in my vienv. I have tried all of the below:
pip installing in global site-packages instead of virtualenv and
http://w3facility.org/question/pip-installing-in-global-site-packages-instead-of-virtualenv/
And many more...if you need i can paste more links. Please help.

Using a virtual environment with Python 3.4 provides helpful information about dealing with Python 3.x and virtualenv/pyevn.
Find instruction about how to install pip manually on pip.pypa.io.

The Red Hat yum package of Python 3.4 is broken, with pip missing. Other Python 3.4+ distributions might have the same problem.
When you create a virtual environment with:
pyvenv-3.4 py3
source py3/bin/activate
the environment should include pip automatically (in the environment/bin directory, not globally). If it does not, try downloading the pip and setuptools wheels manually as described in https://stackoverflow.com/a/33767179/948866. It's a little more work up front than installing pip the old way, but it makes pyvenv work properly.

Related

Pip error: Fatal error in launcher: Unable to create process using '"'

I've seen many threads about this, and have tried all options except for completely wiping Python off of my machine and re-downloading everything...
I'm using a Windows 10, 64-bit machine, and had already downloaded Python2.7. Commands like 'C:\>pip install seaborn' were not an issue.
I recently downloaded Python3.6, and now my pip will not work - it returns the error in the title.
I have added C:\Python27, C:\Python36, C:\Python27\Scripts, C:\Python36\Scripts to my Path, and still it won't work.
If I type in the command C:\>python27 -m pip install seaborn, however, the pip works. I am really confused why I can no longer just type in pip install and have it work.
Thanks in advance!
You have two versions of Python added to path. To differentiate between 2.7 and 3.6 you have to tell it which version you want otherwise each pip conflicts with the other (it does not know what to install and where) in other words you type pip you could either mean for Python 2 or for Python 3.
Do not rename pip it will break your system (you should not need to rename). Instead use those already provided..
Your system should have these already:
pip is universal. Best for one installation.
pip3 for Python 3. Best to distinguish between Python 2 and 3
pip3.6 to distinguish between different Python 3 installations.
The same goes for Python 2 installation.
pip, pip2 and pip2.7.
You need to use either pip3 (or pip2) or pip3.6 (or pip2.7) to install in future. This will allow the different versions to be recognised:
For Python 2:
pip2 install seaborn
For Python 3:
pip3 install seaborn
You should also now use shebang lines as well now (if you are not already) to distinguish between versions.
the issue is the ambiguity between the two pip that you've mentioned in the Environments. As you mentioned the issue only started occurring when you installed python3 on the same system where python2 was installed and both have pip and hence when you fire up pip in your cmd, Windows System isn't able to pick one out of the two.
Why does your C:>python27 -m pip install seaborn work?
Well it's quite simple, since you've mentioned the python27 there, windows knows exactly which pip you're talking about.
How to fix it?
see the edits for this section. (I tried this, it didn't work) Removed it from the final answer to avoid confusion.
Alternatively, what you can do is,
rename your python.exe for python 3 to python3. Don't forget to put it inside your PATH environment. Just use python for python 2, python3 for python 3.
Their pip are separated, pip for python 2. pip3 for python 3.
Now, run and see the below commands behave:
# will return the default version of pip
pip --version
# will use the Python 2 version of pip
pip2 --version
# will use the Python 3 version of pip
pip3 --version
Okay so I finally worked it out...
I uninstalled Python3.6 and deleted all relevant folders.
I then went to Control Panel>Programs>Progams and Features and repaired my Python2.7 program. pip works now (I think it got messed up since I tried to rename the universal pip.exe file -> don't do that!!).
After re-downloading Python3.6, I put my universal pip.exe download from Python3 in a different directory so the Path would not get it confused. I now have Paths for both pip2 and pip3 and all is okay.
Thanks for your help!
This is how I solved this issue on my end: (short answer, remove this folder C:\Python27)
Problem: I installed python 3, after uninstalling python 2.7. The issue here is that pip remains behind even after you uninstall python 2.7.
Solution:
1. Uninstall python 3 (if you have it installed).
2. Just in case, I would uninstall python 2.7.
3. This is the key: go to C:\Python27 ... and delete the entire directory (which also contains pip).
This solution is good for those that are fine with ONLY running Python 3 on their machines (which was my case).

How to make 'pip install' not uninstall other versions?

I am managing several modules on an HPC, and want to install some requirements for a tool using pip.
I won't use virtualenv because they don't work well with our module system. I want to install module-local versions of packages and will set PYTHONPATH correctly when the module is loaded, and this has worked just fine when the packages I am installing are not also installed in the default python environment.
What I do not want to do is uninstall the default python's versions of packages while I am installing module-local versions.
For example, one package requires numpy==1.6, and the default version installed with the python I am using is 1.8.0. When I
pip install --install-option="--prefix=$RE_PYTHON" numpy==1.6
where RE_PYTHON points to the top of the module-local site-packages directory, numpy==1.6 installs fine, then pip goes ahead and starts uninstalling 1.8.0 from the tree of the python I am using (why it wants to uninstall a newer version is beyond me but I want to avoid this even when I am doing a local install of e.g. numpy==1.10.1).
How can I prevent pip from doing that? It is really annoying and I have not been able to find a solution that doesn't involve virtualenv.
You have to explicitly tell pip to ignore the current installed package by specifying the -I option (or --ignore-installed). So you should use:
PYTHONUSERBASE=$RE_PYTHON pip install -I --user numpy==1.6
This is mentioned in this answer by Ian Bicking.

Installing numpy for Python 2.7 while also having Python 3.4 installed?

I have both Python 2.7 and Python 3.4 (and have to have both because for the class I'm running, students have the option of using either). One student has used Python 2.7 and numpy for their project, but when I attempt to install numpy, it installs it to 3.4. I need to install it to 2.7.
I'm using numpy 1.9 from this site, which I'm told is also 2.7-specific: http://sourceforge.net/projects/numpy/files/NumPy/
However, nonetheless it still goes to the 3.4 folder. Copying it to Python 2.7 didn't work, obviously.
How do I do this?
I recommend installing with pip.
pip install numpy
If this doesn't work on windows then download the binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and convert it to a wheel before installing.
pip install wheel
wheel convert path/to/binary
pip install numpy_wheel
Pip is recommended because you can uninstall.
To check where you are installing to
pip -V
You may have an environmental variable path to the wrong pip.
Assuming that you are using, or at least you should use pip to install the library. You can specify the python version to be installed by changing the suffix, e.g. pip-2.7 install numpy.
pip install numpy
pip-2.7 install numpy
pip-3.4 install numpy
As an alternative, in case that you do not want to use pip is to download and install the library using setup with a similar technique.
python setup.py install
python2.7 setup.py install
python3.4 setup.py install
Your PATH isn't setup correctly.
C:> where pip
Should tell you which pip it is trying to use, and it is likely whichever one it found on your PATH first...
So, instead, you will want to run it as
C:> C:\mypython2install\pip.exe install numpy
Or, setup your path correctly. See here
Just one other note on issues like this. I had a similar problem with Python 2.7 libraries not being found, because I had miniconda installed for a Python virtual environment that was hijacking calls to python from other programs. After deleting the minconda directory in my home the problem went away and python libraries that were properly installed were found again.
Note-This answer is particularly for Windows PC which has both Python2 & Pyhton3 installed on it.
Both the versions of Python has their different directories somewhat like
"C:\Python27\" ----for python2
"C:\Python35\" ---- for python3
*(or it depends on what path you chose while installing Python**)*
pip GENERALLY exist under the directory "C:\Python**\Scripts"
there you can find exe files like:
pip.exe/pip2.exe/pip2.7.exe ----for python2
pip3.exe/pip3.5.exe ----for python3
to install packages on python2:
use
Python27\Scripts\pip2.exe install package_name
(where the 1st argument is the path of exe file, it might differ for your system)
to install packages on python3:
use
Python35\Scripts\pip3.exe install package_name
there is no need to uninstall any version of python to achieve the task.

installing modules in python - pip, distribute, nose, virtualenv

I'm aware that there are similar questions on SO. This one, for example: What's the proper way to install pip, virtualenv, and distribute for Python?
I'd like to install these modules as per my Learn Python the Hard Way tutorial: http://learnpythonthehardway.org/book/ex46.html
I managed (I think) to install pip by using sudo easy_install pip but when I then ran pydoc modules I could not see it. So I'm not even sure it's installed.
The answer above in question 4324558 is difficult for me to understand: what's a bootstrap, what's curl and why would I set up a virtual environment? Yes, as a learner I should try to pick up as much as I can but I don't want to first create the universe, I just want to get the task at hand done.
How do I install these modules? Is it as complicated as it sounds in the quoted answer? The top voted answer says "Install virtualenv into a bootstrap virtual environment. Use the that virtual environment to create more. Since virtualenv ships with pip and distribute, you get everything from one install."
I really don't get what all that means. Isn't there something about the "Zen" of python and a one true way to get things done? Or am I out of context here? What is "the right way" to install these modules?
I tried:
pip install virtualenv in the terminal and received the following output:
Wheel installs require setuptools >= 0.8 for dist-info support.
pip's wheel support requires setuptools >= 0.8 for dist-info support.
Storing debug log for failure in /Users/myname/.pip/pip.log
I'm using a Mac and python 2.7
To solve your issue,
Just install (or upgrade) the setuptools:
sudo easy_install -U setuptools
Then you can run again: pip install virtualenv
Try adding 'sudo' in your command as-
sudo pip install virtualenv
It worked for me.
Have a look at Python Development Environment on Mac OS X Mavericks 10.9.
I followed these steps as well when trying to get Python 2.7 and Python 3.3 installed on OS X. It doesn't tell you how to install nose and distribute, but you should have a working environment and you can pick up from there.
I did have a problem using virtualenv and pip with Python 3, the question and solutions is available here.

pip listing global packages in active virtualenv

After upgrading pip from 1.4.x to 1.5 pip freeze outputs a list of my globally installed (system) packages instead of the ones installed inside of my virtualenv. I've tried downgrading to 1.4 again but that does not solve my problem. It's somewhat similar to this question only it's been working as expected for months. Is there any way to debug and/or repair this?
It seems like the virtualenv has no effect at all. Installing packages within it installs them globally too.
I had problems with pip installing packages globally instead of in the activated virtualenv too. Have a look at pip installing in global site-packages instead of virtualenv for the question (and the answer).
Basically, the solution consisted of modifying the shebang of the pip scripts within the virtualenv as they pointed to the wrong python installation.
Even if you have installed properly, but with global site packages visible to your virtualenv, still pip will list everything, unless you use pip list --local discussed here.

Categories

Resources