Hi! If I create a Python 2 virtual environment with virtualenv and the -- system-site-packages option, installation of any subsequent package works as expected:
[vagrant@tadej-zbook ~]$ rpm -q python2-virtualenv python2-virtualenv-15.0.3-2.fc25.noarch [vagrant@tadej-zbook ~]$ virtualenv --system-site-packages myvenv2 New python executable in /home/vagrant/myvenv2/bin/python2 Also creating executable in /home/vagrant/myvenv2/bin/python Installing setuptools, pip, wheel...done. [vagrant@tadej-zbook ~]$ source myvenv2/bin/activate (myvenv2) [vagrant@tadej-zbook ~]$ pip install Django Collecting Django Downloading Django-1.10.5-py2.py3-none-any.whl (6.8MB) 100% |████████████████████████████████| 6.8MB 214kB/s Installing collected packages: Django Successfully installed Django-1.10.5 On the other hand, if I create a Python 3 virtual environment with venv and use the --system-site-packages option, installation of any subsequent package fails: [vagrant@tadej-zbook ~]$ rpm -q python3-libs python3-libs-3.5.2-4.fc25.x86_64 [vagrant@tadej-zbook ~]$ python3 -m venv --system-site-packages myvenv3 [vagrant@tadej-zbook ~]$ source myvenv3/bin/activate (myvenv3) [vagrant@tadej-zbook ~]$ pip3 install Django Collecting Django Using cached Django-1.10.5-py2.py3-none-any.whl Installing collected packages: Django Exception: Traceback (most recent call last): File "/usr/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/lib/python3.5/site-packages/pip/commands/install.py", line 326, in run strip_file_prefix=options.strip_file_prefix, File "/usr/lib/python3.5/site-packages/pip/req/req_set.py", line 742, in install **kwargs File "/usr/lib/python3.5/site-packages/pip/req/req_install.py", line 834, in install strip_file_prefix=strip_file_prefix File "/usr/lib/python3.5/site-packages/pip/req/req_install.py", line 1037, in move_wheel_files strip_file_prefix=strip_file_prefix, File "/usr/lib/python3.5/site-packages/pip/wheel.py", line 346, in move_wheel_files clobber(source, lib_dir, True) File "/usr/lib/python3.5/site-packages/pip/wheel.py", line 317, in clobber ensure_dir(destdir) File "/usr/lib/python3.5/site-packages/pip/utils/__init__.py", line 83, in ensure_dir os.makedirs(path) File "/usr/lib64/python3.5/os.py", line 241, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.5/site-packages/Django-1.10.5.dist-info' Apparently pip inside the virtual environment tried to install Django to the system-wide location (/usr/lib/python3.5/site-packages/) and failed (as expected). But why did it try to install Django in the system-wide location instead of virtual environment's site-packages directory? Taking a closer look to the created Python 3 virtual environment reveals that it doesn't contain it's own pip3 command: (myvenv3) [vagrant@tadej-zbook ~]$ ls -al myvenv3/bin/ total 20 drwxrwxr-x. 2 vagrant vagrant 4096 Feb 2 14:49 . drwxrwxr-x. 5 vagrant vagrant 4096 Feb 2 14:49 .. -rw-r--r--. 1 vagrant vagrant 2143 Feb 2 14:49 activate -rw-r--r--. 1 vagrant vagrant 1259 Feb 2 14:49 activate.csh -rw-r--r--. 1 vagrant vagrant 2397 Feb 2 14:49 activate.fish lrwxrwxrwx. 1 vagrant vagrant 7 Feb 2 14:49 python -> python3 lrwxrwxrwx. 1 vagrant vagrant 16 Feb 2 14:49 python3 -> /usr/bin/python3 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. Is there a reason this behavior has changed compared to Python 2 and virtualenv command or is it simply a bug that I should report? Thanks for help and regards, Tadej _______________________________________________ python-devel mailing list -- python-devel@lists.fedoraproject.org To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org