virtualenv is not isolated. You can still use packages installed system-wide
See original GitHub issueAs I understand this pipenv shell
should activate a virtualenv, isolated from the rest of the system. This is not what’s happening.
$ python -m pipenv.help output
Pipenv version: '11.8.1'
Pipenv location: '/usr/local/lib/python3.6/site-packages/pipenv-11.8.1-py3.6.egg/pipenv'
Python location: '/usr/bin/python'
Other Python installations in PATH
:
-
2.7
:/usr/bin/python2.7
-
2.7
:/usr/bin/python2.7
-
3.6
:/usr/bin/python3.6m
-
3.6
:/usr/bin/python3.6
-
3.6.4
:/usr/bin/python
-
2.7.14
:/usr/bin/python2
-
3.6.4
:/usr/bin/python3
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.6.4',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.15.9-1-ARCH',
'platform_system': 'Linux',
'platform_version': '#1 SMP PREEMPT Sun Mar 11 17:54:33 UTC 2018',
'python_full_version': '3.6.4',
'python_version': '3.6',
'sys_platform': 'linux'}
System environment variables:
LANG
HISTCONTROL
DISPLAY
OLDPWD
INVOCATION_ID
EDITOR
NODE_PATH
COLORTERM
TERMINAL
XDG_VTNR
XDG_SESSION_ID
USER
GOPATH
PWD
HOME
LESSHISTFILE
JOURNAL_STREAM
GTK_MODULES
MAIL
WINDOWPATH
TERM
SHELL
VTE_VERSION
QT_IM_MODULE
XMODIFIERS
XDG_SEAT
SHLVL
PYTHONPATH
WINDOWID
MAVEN_OPTS
LOGNAME
DBUS_SESSION_BUS_ADDRESS
XDG_RUNTIME_DIR
XAUTHORITY
PATH
GTK_IM_MODULE
_
PIP_PYTHON_PATH
PYTHONUNBUFFERED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/g/.go/bin:/home/g/.node_modules/bin
SHELL
:/bin/bash
EDITOR
:/usr/bin/nvim
LANG
:en_US.UTF-8
PWD
:/home/g/hack
Expected result
Creating a new project and running pipenv shell
should result in a minimal set of installed packages.
Actual result
All the system-wide packages can be imported.
(foo-5Z-S40FS) [g@x220 foo]$ pipenv graph
appdirs==1.4.3
Archey3==0.4
beautifulsoup4==4.6.0
Brlapi==0.6.7
capstone==3.0.4
codegen==1.0
cryptography==2.1.4
- asn1crypto [required: >=0.21.0, installed: 0.24.0]
- cffi [required: >=1.7, installed: 1.11.5]
- pycparser [required: Any, installed: 2.18]
- idna [required: >=2.1, installed: 2.6]
- six [required: >=1.4.1, installed: 1.11.0]
curio==0.9
dbfread==2.0.6
decorator==4.2.1
docutils==0.14
Faker==0.8.12
- python-dateutil [required: >=2.4, installed: 2.7.0]
- six [required: >=1.5, installed: 1.11.0]
- six [required: Any, installed: 1.11.0]
- text-unidecode [required: Any, installed: 1.2]
flake8==3.5.0
- mccabe [required: >=0.6.0, installed: 0.6.1]
- pycodestyle [required: >=2.0.0, installed: 2.3.1]
- pyflakes [required: >=1.5.0, installed: 1.6.0]
- setuptools [required: >=30, installed: 38.6.0]
gmpy2==2.1.0a1
ipython==6.2.1
ipywidgets==6.0.0
isc==2.0
jedi==0.11.1
- parso [required: ==0.1.1, installed: 0.1.1]
jsonschema==2.6.0
jupyter-console==5.2.0
leather==0.3.3
- six [required: >=1.6.1, installed: 1.11.0]
lxml==4.1.1
matplotlib==2.1.2
- cycler [required: >=0.10, installed: 0.10.0]
- six [required: Any, installed: 1.11.0]
- numpy [required: >=1.7.1, installed: 1.14.1]
- pyparsing [required: !=2.1.6,!=2.0.4,!=2.1.2,>=2.0.1, installed: 2.2.0]
- python-dateutil [required: >=2.1, installed: 2.7.0]
- six [required: >=1.5, installed: 1.11.0]
- pytz [required: Any, installed: 2018.3]
- six [required: >=1.10, installed: 1.11.0]
mock==2.0.0
- pbr [required: >=0.11, installed: 3.1.1]
- six [required: >=1.9, installed: 1.11.0]
namcap==3.2.7
neovim==0.2.4
- greenlet [required: Any, installed: 0.4.13]
- msgpack [required: >=0.5.0, installed: 0.5.6]
nltk==3.2.5
- six [required: Any, installed: 1.11.0]
olefile==0.45.1
- pyparsing [required: Any, installed: 2.2.0]
- six [required: Any, installed: 1.11.0]
pandas==0.22.0
- numpy [required: >=1.9.0, installed: 1.14.1]
- python-dateutil [required: >=2, installed: 2.7.0]
- six [required: >=1.5, installed: 1.11.0]
- pytz [required: >=2011k, installed: 2018.3]
pexpect==4.4.0
pickleshare==0.7.4
Pillow==5.0.0
pipenv==11.8.1
- certifi [required: Any, installed: 2018.1.18]
- pip [required: >=9.0.1, installed: 9.0.1]
- setuptools [required: >=36.2.1, installed: 38.6.0]
- virtualenv [required: Any, installed: 15.1.0]
- virtualenv-clone [required: >=0.2.5, installed: 0.3.0]
ply==3.11
progressbar2==3.30.0
- python-utils [required: >=2.1.0, installed: 2.3.0]
- six [required: Any, installed: 1.11.0]
prompt-toolkit==1.0.15
- six [required: >=1.9.0, installed: 1.11.0]
- wcwidth [required: Any, installed: 0.1.7]
ptyprocess==0.5.2
pyalpm==0.8
PyAudio==0.2.11
pycrypto==2.6.1
pydocstyle==2.1.1
- six [required: Any, installed: 1.11.0]
- snowballstemmer [required: Any, installed: 1.2.1]
pyelftools==0.24
pygobject==3.26.1
PyPDF2==1.26.0
pytest==3.4.2
- attrs [required: >=17.2.0, installed: 17.4.0]
- pluggy [required: >=0.5,<0.7, installed: 0.6.0]
- py [required: >=1.5.0, installed: 1.5.2]
- setuptools [required: Any, installed: 38.6.0]
- six [required: >=1.10.0, installed: 1.11.0]
python-slugify==1.2.4
- Unidecode [required: >=0.04.16, installed: 1.0.22]
pytimeparse==1.1.7
pyxdg==0.25
PyYAML==3.12
r2pipe==0.9.8
ROPGadget==5.6
ropper==1.11.6
- filebytes [required: >=0.9.12, installed: 0.9.15]
scikit-learn==0.19.1
scipy==1.0.0
shodan==1.7.7
- click [required: Any, installed: 6.7]
- click-plugins [required: Any, installed: 1.0.3]
- click [required: >=3.0, installed: 6.7]
- colorama [required: Any, installed: 0.3.9]
- requests [required: >=2.2.1, installed: 2.18.4]
- chardet [required: <3.1.0,>=3.0.2, installed: 3.0.4]
- idna [required: >=2.5,<2.7, installed: 2.6]
- urllib3 [required: >=1.21.1,<1.23, installed: 1.22]
- XlsxWriter [required: Any, installed: 1.0.2]
simplegeneric==0.8.1
simplejson==3.13.2
tensorflow==1.6.0
- absl-py [required: >=0.1.6, installed: 0.1.10]
- six [required: Any, installed: 1.11.0]
- astor [required: >=0.6.0, installed: 0.6.2]
- gast [required: >=0.2.0, installed: 0.2.0]
- grpcio [required: >=1.8.6, installed: 1.9.1]
- protobuf [required: >=3.5.0.post1, installed: 3.5.1]
- setuptools [required: Any, installed: 38.6.0]
- six [required: >=1.9, installed: 1.11.0]
- six [required: >=1.5.2, installed: 1.11.0]
- numpy [required: >=1.13.3, installed: 1.14.1]
- protobuf [required: >=3.4.0, installed: 3.5.1]
- setuptools [required: Any, installed: 38.6.0]
- six [required: >=1.9, installed: 1.11.0]
- six [required: >=1.10.0, installed: 1.11.0]
- tensorboard [required: <1.7.0,>=1.6.0, installed: 1.6.0]
- bleach [required: ==1.5.0, installed: 1.5.0]
- html5lib [required: !=0.99999,>=0.999,!=0.9999,<0.99999999, installed: 0.9999999]
- six [required: Any, installed: 1.11.0]
- six [required: Any, installed: 1.11.0]
- html5lib [required: ==0.9999999, installed: 0.9999999]
- six [required: Any, installed: 1.11.0]
- markdown [required: >=2.6.8, installed: 2.6.11]
- numpy [required: >=1.12.0, installed: 1.14.1]
- protobuf [required: >=3.4.0, installed: 3.5.1]
- setuptools [required: Any, installed: 38.6.0]
- six [required: >=1.9, installed: 1.11.0]
- six [required: >=1.10.0, installed: 1.11.0]
- werkzeug [required: >=0.11.10, installed: 0.14.1]
- wheel [required: >=0.26, installed: 0.30.0]
- termcolor [required: >=1.1.0, installed: 1.1.0]
- wheel [required: >=0.26, installed: 0.30.0]
unicorn==1.0.1
webencodings==0.5.1
widgetsnbextension==2.0.0
- notebook [required: >=4.4.1, installed: 5.3.0]
- ipykernel [required: Any, installed: 4.6.1]
- ipython-genutils [required: Any, installed: 0.1.0]
- jinja2 [required: Any, installed: 2.10]
- MarkupSafe [required: >=0.23, installed: 1.0]
- jupyter-client [required: >=5.2.0, installed: 5.2.2]
- jupyter-core [required: Any, installed: 4.4.0]
- python-dateutil [required: >=2.1, installed: 2.7.0]
- six [required: >=1.5, installed: 1.11.0]
- pyzmq [required: >=13, installed: 16.0.3]
- tornado [required: >=4.1, installed: 4.5.3]
- traitlets [required: Any, installed: 4.3.2]
- jupyter-core [required: >=4.4.0, installed: 4.4.0]
- nbconvert [required: Any, installed: 5.3.1]
- bleach [required: Any, installed: 1.5.0]
- html5lib [required: !=0.99999,>=0.999,!=0.9999,<0.99999999, installed: 0.9999999]
- six [required: Any, installed: 1.11.0]
- six [required: Any, installed: 1.11.0]
- entrypoints [required: >=0.2.2, installed: 0.2.3]
- jinja2 [required: Any, installed: 2.10]
- MarkupSafe [required: >=0.23, installed: 1.0]
- jupyter-core [required: Any, installed: 4.4.0]
- mistune [required: >=0.7.4, installed: 0.8.1]
- nbformat [required: >=4.4, installed: 4.4.0]
- pandocfilters [required: >=1.4.1, installed: 1.4.2]
- pygments [required: Any, installed: 2.2.0]
- testpath [required: Any, installed: 0.3.1]
- traitlets [required: >=4.2, installed: 4.3.2]
- nbformat [required: Any, installed: 4.4.0]
- Send2Trash [required: Any, installed: 1.5.0]
- terminado [required: >=0.8.1, installed: 0.8.1]
- tornado [required: >=4, installed: 4.5.3]
- traitlets [required: >=4.2.1, installed: 4.3.2]
xlrd==1.1.0
youtube-dl==2018.3.14
Steps to replicate
mkdir foo
cd foo
pipenv install
pipenv shell
pipenv graph # , or pip list
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
virtualenv: Specifing which packages to use system-wide ...
The simplest way to do this is to create a virtualenv which includes the system site packages and then install the versions that...
Read more >Stop Installing Python Packages Globally — Use Virtual ...
Python virtual environments allow you to install Python packages in an isolated location for a particular application instead of installing them globally.
Read more >How to Manage Python Dependencies using Virtual ...
Inside our environment, system-wide packages are not accessible and any packages installed inside the environment are not available outside. ...
Read more >A Guide to Python's Virtual Environments
Inside our environment we cannot access system-wide site packages and any packages we install will not be accessible outside of our environment.
Read more >Pipenv & Virtual Environments
If you do not have Python, please install the latest 3.x version from ... This does a user installation to prevent breaking any...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My general recommendation is to not ever use pacman for python packages and when at all possible install with
pip install --user
.No matter why you set it in the first place, you need to unset it when you want isolation.
PYTHONPATH
is an ultimate override to other rules. If you set it, Pipenv honours it. All Python virtual environment tools do this. You can’t expect otherwise because that’s how the whole ecosystem is designed to work.