On Thu, 2017-02-02 at 11:34 -0800, Craig Rodrigues wrote:
> Which in turn means 'pip3 install Django' actually used
the system-
> wide
> pip3 command which tried to install Django to the system-wide
> location
> and failed.
>
>
After you create your Python 3 virtualev, what files are in the bin
directory of your Pythin 3 virtualenv?
[vagrant@tadej-zbook ~]$ ls -al myvenv3/bin/
total 20
drwxrwxr-x. 2 vagrant vagrant 4096 Feb 3 08:31 .
drwxrwxr-x. 5 vagrant vagrant 4096 Feb 3 08:31 ..
-rw-r--r--. 1 vagrant vagrant 2143 Feb 3 08:31 activate
-rw-r--r--. 1 vagrant vagrant 1259 Feb 3 08:31 activate.csh
-rw-r--r--. 1 vagrant vagrant 2397 Feb 3 08:31 activate.fish
lrwxrwxrwx. 1 vagrant vagrant 7 Feb 3 08:31 python -> python3
lrwxrwxrwx. 1 vagrant vagrant 16 Feb 3 08:31 python3 ->
/usr/bin/python3
Is there a pip file?
No.
Once you are inside your virtualenv and sourced the bin/activate
script, my advice to you is to either:
- just run the command "pip"
Since there is no pip command in virtualenv's bin/ directory, pip is
the global Python 2 version of pip:
[vagrant@tadej-zbook ~]$ pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
- run the command "python -m pip"
Yay, this works:
(myvenv3) [vagrant@tadej-zbook ~]$ python -m pip install Django
Collecting Django
Using cached Django-1.10.5-py2.py3-none-any.whl
Installing collected packages: Django
Successfully installed Django-1.10.5
So, this apparently boils down to:
1) If one uses "python3 -m venv --system-site-packages myvenv3", then
no pip executable is installed in myvenv3/bin/.
As a consequence, "pip install foo" fails since it tries to install foo
in system's global site-packages directory.
Using "python -m pip install foo" works as expected.
2) If one uses "python3 -m venv myvenv3-no-system", then pip (and pip3)
executables are installed in myvenv3-no-system/bin/.
Both, "pip install foo" and "python -m pip install foo" work as
expected.
Is this something specific to Fedora's Python 3 packaging?
If not, I'll post a question to the distutils mailing list.
Thanks,
Tadej