`pipenv run` does *not* ensure required packages are installed
See original GitHub issueIn a directory without a virtual environment the command
pipenv run python myprog.py
fails with
Traceback (most recent call last):
File "listmycmds.py", line 19, in <module>
import argh
ModuleNotFoundError: No module named 'argh'
although the module argh
is in requirements.txt
.
When I run
pipenv install
and then
pipenv run python myprog.py
everything is fine.
I expect - following the documentation - that pipenv run ...
installs the required packages, but it doesn’t.
Notes
1. Running Python version
- Pipenv is installed into the
python 3.5
which is located at /usr/bin/python3. - The environments I geenrate are using
Python3.6
which is located at /usr/local/bin/python3.6.
2. python -m pipenv.help
output
Here the output from after I ran my command:
<details><summary>$ python -m pipenv.help output</summary>
Pipenv version: `'11.10.1'`
Pipenv location: `'/usr/local/lib/python3.5/site-packages/pipenv'`
Python location: `'/usr/bin/python3'`
Other Python installations in `PATH`:
- `2.6`: `/usr/bin/python2.6`
- `2.6`: `/usr/bin/python2.6`
- `2.7`: `/usr/local/bin/python2.7`
- `2.7`: `/usr/local/bin/python2.7`
- `3.4`: `/usr/local/bin/python3.4m`
- `3.4`: `/usr/local/bin/python3.4`
- `3.5`: `/usr/local/bin/python3.5m`
- `3.5`: `/usr/local/bin/python3.5`
- `3.6`: `/usr/local/bin/python3.6m`
- `3.6`: `/usr/local/bin/python3.6`
- `2.6.6`: `/usr/bin/python`
- `2.6.6`: `/usr/bin/python2`
- `3.6.4`: `/home/broleo/bin/python3`
- `3.5.2`: `/usr/local/bin/python3`
- `3.5.2`: `/usr/bin/python3`
PEP 508 Information:
```
{'implementation_name': 'cpython',
'implementation_version': '3.5.2',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.1.12-94.5.7.el6uek.x86_64',
'platform_system': 'Linux',
'platform_version': '#2 SMP Thu Jul 20 18:39:04 PDT 2017',
'python_full_version': '3.5.2',
'python_version': '3.5',
'sys_platform': 'linux'}
```
System environment variables:
- `PYTHONDONTWRITEBYTECODE`
- `PATH`
- `SSH_CLIENT`
- `EMACSEXE`
- `HOME`
- `INSIDE_EMACS`
- `SHELL`
- `TMUX`
- `PROMPT_COMMAND`
- `ORACLE_HOME`
- `SSH_TTY`
- `LS_COLORS`
- `LANG`
- `PIPENV_VENV_IN_PROJECT`
- `TERM`
- `QTINC`
- `PIP_PYTHON_PATH`
- `COLUMNS`
- `HTTPS_PROXY`
- `HOSTNAME`
- `_`
- `http_proxy`
- `TMUX_PANE`
- `HISTCONTROL`
- `https_proxy`
- `BROWSER`
- `SSH_CONNECTION`
- `LESSHISTFILE`
- `QTDIR`
- `PS1`
- `SHLVL`
- `PIPENV_DEFAULT_PYTHON_VERSION`
- `GIT_EDITOR`
- `HISTTIMEFORMAT`
- `USER`
- `DISPLAY`
- `LOGNAME`
- `HTTP_PROXY`
- `PWD`
- `MAIL`
- `WORKON_HOME`
- `QTLIB`
- `CVS_RSH`
- `MYCMDSPATH`
- `VENV`
- `LESSOPEN`
- `LD_LIBRARY_PATH`
- `HISTSIZE`
- `G_BROKEN_FILENAMES`
- `TERMCAP`
Pipenv–specific environment variables:
- `PIPENV_VENV_IN_PROJECT`: `yes`
- `PIPENV_DEFAULT_PYTHON_VERSION`: `3.6`
Debug–specific environment variables:
- `PATH`: `/home/broleo/bin:/working/software/bin::/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/u01/app/oracle/product/11.2.0/bin:/home/broleo/go/bin:/usr/local/nodejs/node8/bin`
- `SHELL`: `/bin/bash`
- `LANG`: `en_US.UTF-8`
- `PWD`: `/working/software/broleo/devel/system/listmycmds`
---------------------------
Contents of `Pipfile` ('/working/software/broleo/devel/system/listmycmds/Pipfile'):
```toml
[[source]]
verify_ssl = true
name = "pypi"
url = "https://pypi.python.org/simple"
[dev-packages]
[packages]
argh = ">=0.26.2"
```
Contents of `Pipfile.lock` ('/working/software/broleo/devel/system/listmycmds/Pipfile.lock'):
```json
{
"_meta": {
"hash": {
"sha256": "c55ba166f3e7a75e9fef7b7f3212a61d66b6712edac5bd57ccc93c13f0668206"
},
"pipfile-spec": 6,
"requires": {},
"sources": [
{
"name": "pypi",
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"argh": {
"hashes": [
"sha256:a9b3aaa1904eeb78e32394cd46c6f37ac0fb4af6dc488daa58971bdc7d7fcaf3",
"sha256:e9535b8c84dc9571a48999094fda7f33e63c3f1b74f3e5f3ac0105a58405bb65"
],
"index": "pypi",
"version": "==0.26.2"
}
},
"develop": {}
}
```
</details>
Issue Analytics
- State:
- Created 5 years ago
- Comments:20 (12 by maintainers)
Top Results From Across the Web
Frequently Encountered Pipenv Problems - Read the Docs
This is usually a result of mixing Pipenv with system packages. We strongly recommend installing Pipenv in an isolated environment. Uninstall all existing ......
Read more >Pipenv install does not install everything from Pipfile
Installing from this pipfile using pipenv install worked fine, and all packages were installed. I am not exactly sure why this all happened, ......
Read more >Common Pipenv Errors - Towards Data Science
The Pipfile stores the packages or dependencies required to run the project's code. For those who have developed with pip, the Pipfile is...
Read more >pipenv Documentation - Read the Docs
Will create a virtual env and install dependencies (if it does not exist ... Using $ pipenv run ensures that your installed packages...
Read more >Pipenv & Virtual Environments
If you do not have Python, please install the latest 3.x version from ... Using $ pipenv run ensures that your installed packages...
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
As another voice in this issue, I also think that the current behavior (run will create a virtualenv but not install dependencies) is very confusing.
Can I suggest not creating the virtualenv at all then? Creating the env without installing packages can only be misleading as developers will assume packages were installed, and there is no way an app is going to run if its dependencies are not installed. Failing due to no env would be much clearer to debug.