On 3 February 2017 at 09:58, Tadej Janež <tade...@nez.si> wrote:
> 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.

It's not specific to Fedora's Python 3 packaging as such, but it *is*
specific to:

- using --system-site-packages
- having pip install in the system site packages

However, the way Fedora handles the native venv support in Python 3
means that this case will *always* apply when creating Python 3
virtual environments that can see the virtual environments - the pip
that gets installed into the virtual environment comes from
python-pip, rather than being a bundled copy in the Python RPM.

That means you have to pass "--ignore-installed" to get pip to
actually install into the virtual environment properly:

    (venv2) $ which pip
    /usr/bin/pip
    (venv2) $ python -m pip install --ignore-installed pip
    Collecting pip
     Using cached pip-9.0.1-py2.py3-none-any.whl
    Installing collected packages: pip
    (venv2) $ which pip
    /tmp/venv2/bin/pip

I think that makes sense at least as a BZ against the Fedora Python 3
package (to pass --ignore-installed when installing components into
the venv), and it may even make sense to file it as a bug against
CPython upstream as well, since it will happen any time you have the
three way combination of:

- system wide installation of pip
- using native stdlib venv creation
- the created venv is configured to have access to the system site packages

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org

Reply via email to