I was troubleshooting an opened bug (https://github.com/pypa/pipenv/issues/1639) that I seem to have run into. In trying to reproduce it, it seems like i bumped into another issue.
This looks similar to the closed https://github.com/pypa/pipenv/issues/1441 issue, however, the command virtualenv --python=python3 myenv
did not error out as anticipated in the comments.
I expected to see a Pipfile
and Pipfile.lock
in the /tmp/test1
directory.
Saw the strack trace above.
saviles ξ° ~ ξ° 1 ξ° docker run --rm -ti fedora:27 /bin/bash
[root@0958ee759ab3 /]# dnf install -qy which
install-info: No such file or directory for /usr/share/info/which.info.gz
[root@0958ee759ab3 /]# pip3 install --user pipenv
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting pipenv
Downloading pipenv-11.2.0.tar.gz (4.1MB)
100% |ββββββββββββββββββββββββββββββββ| 4.1MB 412kB/s
Collecting setuptools>=36.2.1 (from pipenv)
Downloading setuptools-38.5.2-py2.py3-none-any.whl (490kB)
100% |ββββββββββββββββββββββββββββββββ| 491kB 2.3MB/s
Collecting virtualenv (from pipenv)
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
100% |ββββββββββββββββββββββββββββββββ| 1.8MB 810kB/s
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl
Installing collected packages: setuptools, virtualenv, virtualenv-clone, pipenv
Running setup.py install for pipenv ... done
Successfully installed pipenv-11.2.0 setuptools-38.5.2 virtualenv-15.1.0 virtualenv-clone-0.3.0
[root@0958ee759ab3 /]# mkdir /tmp/test1
[root@0958ee759ab3 /]# cd /tmp/test1
[root@0958ee759ab3 test1]# python3 -m pipenv install requests
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Creating a virtualenv for this projectβ¦
β Using base prefix '/usr'
New python executable in /root/.local/share/virtualenvs/test1-MiVIN7Yf/bin/python3
Also creating executable in /root/.local/share/virtualenvs/test1-MiVIN7Yf/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location:
Creating a Pipfile for this projectβ¦
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/root/.local/lib/python3.6/site-packages/pipenv/__main__.py", line 4, in <module>
cli()
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/root/.local/lib/python3.6/site-packages/pipenv/cli.py", line 197, in install
selective_upgrade=selective_upgrade
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 1767, in do_install
ensure_project(three=three, python=python, system=system, warn=True, deploy=deploy, skip_requirements=skip_requirements)
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 688, in ensure_project
ensure_pipfile(validate=validate, skip_requirements=skip_requirements)
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 341, in ensure_pipfile
project.create_pipfile(python=python)
File "/root/.local/lib/python3.6/site-packages/pipenv/project.py", line 439, in create_pipfile
data[u'requires'] = {'python_version': python_version(self.which('python'))[:len('2.7')]}
TypeError: 'NoneType' object is not subscriptable
[root@0958ee759ab3 test1]# python3 -m pipenv.help
Pipenv version: '11.2.0'
Pipenv location: '/root/.local/lib/python3.6/site-packages/pipenv'
Python location: '/usr/bin/python3'
Other Python installations in PATH
:
3.6
: /usr/bin/python3.6m
3.6
: /usr/bin/python3.6
3.6
: /bin/python3.6
3.6.2
: /usr/bin/python3
3.6.2
: /bin/python3
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.6.2',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.15.6-300.fc27.x86_64',
'platform_system': 'Linux',
'platform_version': '#1 SMP Mon Feb 26 18:43:03 UTC 2018',
'python_full_version': '3.6.2',
'python_version': '3.6',
'sys_platform': 'linux'}
System environment variables:
LS_COLORS
HOSTNAME
PWD
HOME
FBR
DISTTAG
FGC
TERM
SHLVL
PATH
_
OLDPWD
LC_CTYPE
PIP_PYTHON_PATH
Pipenvβspecific environment variables:
Debugβspecific environment variables:
PATH
: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD
: /tmp/test1
Contents of Pipfile
('/tmp/test1/Pipfile'):
[root@0958ee759ab3 test1]# envname
bash: envname: command not found
[root@0958ee759ab3 test1]# virtualenv --python=python3 myenv
bash: virtualenv: command not found
[root@0958ee759ab3 test1]# python3 -m virtualenv --python=python3 myenv
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /tmp/test1/myenv/bin/python3
Also creating executable in /tmp/test1/myenv/bin/python
Installing setuptools, pip, wheel...done.
[root@0958ee759ab3 test1]# ls
Pipfile myenv
[root@0958ee759ab3 test1]#
(Edit: Formatting)
Yes! We've been seeing this, but haven't been able to reproduce reliably. Good work!
Here's another manifestation:
$ docker run --rm -it python:latest bash
root@a8acc994176d:/# cd
root@a8acc994176d:~# pip install --user pipenv
Collecting pipenv
Downloading pipenv-11.2.0.tar.gz (4.1MB)
100% |ββββββββββββββββββββββββββββββββ| 4.1MB 322kB/s
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Collecting virtualenv (from pipenv)
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
100% |ββββββββββββββββββββββββββββββββ| 1.8MB 595kB/s
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl
Building wheels for collected packages: pipenv
Running setup.py bdist_wheel for pipenv ... done
Stored in directory: /root/.cache/pip/wheels/21/58/1f/05230cc8f245b4ae4b90338c86c6531ea0629d7717b0b13c8d
Successfully built pipenv
Installing collected packages: virtualenv, virtualenv-clone, pipenv
Successfully installed pipenv-11.2.0 virtualenv-15.1.0 virtualenv-clone-0.3.0
root@a8acc994176d:~# git clone https://github.com/maxalbert/pipenv_bug.git
Cloning into 'pipenv_bug'...
remote: Counting objects: 68, done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 68 (delta 18), reused 65 (delta 15), pack-reused 0
Unpacking objects: 100% (68/68), done.
Checking connectivity... done.
root@a8acc994176d:~# cd pipenv_bug/
root@a8acc994176d:~/pipenv_bug# rm Pipfile.lock
root@a8acc994176d:~/pipenv_bug# pipenv install
bash: pipenv: command not found
root@a8acc994176d:~/pipenv_bug# ~/.local/bin/pipenv install
Creating a virtualenv for this projectβ¦
Using /usr/local/bin/python3.6m to create virtualenvβ¦
β Running virtualenv with interpreter /usr/local/bin/python3.6m
Using base prefix '/usr/local'
New python executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python3.6m
Also creating executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location:
Warning: Your Pipfile requires python_version 3.6, but you are using None (/bin/python).
$ pipenv check will surely fail.
Creating a virtualenv for this projectβ¦
β Using base prefix '/usr/local'
New python executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location:
Pipfile.lock not found, creatingβ¦
Locking [dev-packages] dependenciesβ¦
/python: not found
root@a8acc994176d:~/pipenv_bug# ~/.local/bin/pipenv run pytest --version
Creating a virtualenv for this projectβ¦
Using /usr/local/bin/python3.6m to create virtualenvβ¦
β Running virtualenv with interpreter /usr/local/bin/python3.6m
Using base prefix '/usr/local'
New python executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python3.6m
Not overwriting existing python script /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python (you must use /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python3.6m)
Installing setuptools, pip, wheel...done.
Virtualenv location:
Warning: Your Pipfile requires python_version 3.6, but you are using None (/bin/python).
$ pipenv check will surely fail.
Warning: There was an unexpected error while activating your virtualenv. Continuing anywayβ¦
Error: the command pytest could not be found within PATH or Pipfile's [scripts].
Namely,
Warning: Your Pipfile requires python_version 3.6, but you are using None (/bin/python).
Well, i know one way to solve this.
Don't use Docker? :)
I got past the initial error hacking this:
diff --git a/pipenv/project.py b/pipenv/project.py
index 64577fd..029e94f 100644
--- a/pipenv/project.py
+++ b/pipenv/project.py
@@ -436,7 +436,7 @@ class Project(object):
}
# Default requires.
- data[u'requires'] = {'python_version': python_version(self.which('python'))[:len('2.7')]}
+ data[u'requires'] = {'python_version': python_version(self.which('python3'))[:len('3.')]}
self.write_toml(data, 'Pipfile')
Now i'm trying to bypass the next hurdle
[root@0958ee759ab3 test1]# python3 -m pipenv --venv
No virtualenv has been created for this project yet!
[root@0958ee759ab3 test1]# ls /root/.local/share/virtualenvs/test1-MiVIN7Yf/bin/python
/root/.local/share/virtualenvs/test1-MiVIN7Yf/bin/python
[root@0958ee759ab3 test1]# rm -rf /root/.local/share/virtualenvs/test1-MiVIN7Yf
[root@0958ee759ab3 test1]# python3 -m pipenv install requests
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Creating a virtualenv for this projectβ¦
β Using base prefix '/usr'
New python executable in /root/.local/share/virtualenvs/test1-MiVIN7Yf/bin/python3
Also creating executable in /root/.local/share/virtualenvs/test1-MiVIN7Yf/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location:
Installing requestsβ¦
β
Error: An error occurred while installing requests!
/bin/sh: /bin/pip: No such file or directory
[root@0958ee759ab3 test1]# /root/.local/share/virtualenvs/test1-MiVIN7Yf/bin/python3 --version
Python 3.6.2
[root@0958ee759ab3 test1]# /root/.local/share/virtualenvs/test1-MiVIN7Yf/bin/python --version
Python 3.6.2
[root@0958ee759ab3 test1]#
My suspicion is that there assumptions that python
and pip
will be available but that may not be necessarily the case.
can you try again with the latest version?
pip and virtualenv should always be available within a virtualenv, yes.
I'm still repro-ing on 11.2.2:
$ docker run --rm -it python:latest bash
root@6931fdb72b42:/# cd
root@6931fdb72b42:~# pip install --user pipenv
Collecting pipenv
Downloading pipenv-11.2.2.tar.gz (4.1MB)
100% |ββββββββββββββββββββββββββββββββ| 4.1MB 294kB/s
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Collecting virtualenv (from pipenv)
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
100% |ββββββββββββββββββββββββββββββββ| 1.8MB 716kB/s
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl
Building wheels for collected packages: pipenv
Running setup.py bdist_wheel for pipenv ... done
Stored in directory: /root/.cache/pip/wheels/0c/05/ea/2c54795c34f7c6da5ea0e8013fa6dbd9efed88f02304d10eb1
Successfully built pipenv
Installing collected packages: virtualenv, virtualenv-clone, pipenv
Successfully installed pipenv-11.2.2 virtualenv-15.1.0 virtualenv-clone-0.3.0
root@6931fdb72b42:~# git clone https://github.com/maxalbert/pipenv_bug.git
Cloning into 'pipenv_bug'...
remote: Counting objects: 68, done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 68 (delta 18), reused 65 (delta 15), pack-reused 0
Unpacking objects: 100% (68/68), done.
Checking connectivity... done.
root@6931fdb72b42:~# cd pipenv_bug/
root@6931fdb72b42:~/pipenv_bug# ls -l
total 8
-rw-r--r-- 1 root root 153 Mar 10 01:59 Pipfile
-rw-r--r-- 1 root root 1787 Mar 10 01:59 Pipfile.lock
root@6931fdb72b42:~/pipenv_bug# rm Pipfile.lock
root@6931fdb72b42:~/pipenv_bug# pipenv install
bash: pipenv: command not found
root@6931fdb72b42:~/pipenv_bug# ~/.local/bin/pipenv install
Creating a virtualenv for this projectβ¦
Using /usr/local/bin/python3.6m to create virtualenvβ¦
β Running virtualenv with interpreter /usr/local/bin/python3.6m
Using base prefix '/usr/local'
New python executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python3.6m
Also creating executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location:
Warning: Your Pipfile requires python_version 3.6, but you are using None (/bin/python).
$ pipenv check will surely fail.
Creating a virtualenv for this projectβ¦
β Using base prefix '/usr/local'
New python executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location:
Pipfile.lock not found, creatingβ¦
Locking [dev-packages] dependenciesβ¦
/python: not found
Why is βvirtualenv locationβ empty?
Sent from my iPhone
On Mar 9, 2018, at 9:00 PM, David Tucker notifications@github.com wrote:
I'm still repro-ing on 11.2.2:
$ docker run --rm -it python:latest bash
root@6931fdb72b42:/# cd
root@6931fdb72b42:~# pip install --user pipenv
Collecting pipenv
Downloading pipenv-11.2.2.tar.gz (4.1MB)
100% |ββββββββββββββββββββββββββββββββ| 4.1MB 294kB/s
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Collecting virtualenv (from pipenv)
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
100% |ββββββββββββββββββββββββββββββββ| 1.8MB 716kB/s
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl
Building wheels for collected packages: pipenv
Running setup.py bdist_wheel for pipenv ... done
Stored in directory: /root/.cache/pip/wheels/0c/05/ea/2c54795c34f7c6da5ea0e8013fa6dbd9efed88f02304d10eb1
Successfully built pipenv
Installing collected packages: virtualenv, virtualenv-clone, pipenv
Successfully installed pipenv-11.2.2 virtualenv-15.1.0 virtualenv-clone-0.3.0
root@6931fdb72b42:~# git clone https://github.com/maxalbert/pipenv_bug.git
Cloning into 'pipenv_bug'...
remote: Counting objects: 68, done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 68 (delta 18), reused 65 (delta 15), pack-reused 0
Unpacking objects: 100% (68/68), done.
Checking connectivity... done.
root@6931fdb72b42:~# cd pipenv_bug/
root@6931fdb72b42:~/pipenv_bug# ls -l
total 8
-rw-r--r-- 1 root root 153 Mar 10 01:59 Pipfile
-rw-r--r-- 1 root root 1787 Mar 10 01:59 Pipfile.lock
root@6931fdb72b42:~/pipenv_bug# rm Pipfile.lock
root@6931fdb72b42:~/pipenv_bug# pipenv install
bash: pipenv: command not found
root@6931fdb72b42:~/pipenv_bug# ~/.local/bin/pipenv install
Creating a virtualenv for this projectβ¦
Using /usr/local/bin/python3.6m to create virtualenvβ¦
β Running virtualenv with interpreter /usr/local/bin/python3.6m
Using base prefix '/usr/local'
New python executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python3.6m
Also creating executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python
Installing setuptools, pip, wheel...done.Virtualenv location:
Warning: Your Pipfile requires python_version 3.6, but you are using None (/bin/python).
$ pipenv check will surely fail.
Creating a virtualenv for this projectβ¦
β Using base prefix '/usr/local'
New python executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python
Installing setuptools, pip, wheel...done.Virtualenv location:
Pipfile.lock not found, creatingβ¦
Locking [dev-packages] dependenciesβ¦
/python: not foundβ
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
Thatβs the bug
Sent from my iPhone
On Mar 9, 2018, at 9:00 PM, David Tucker notifications@github.com wrote:
I'm still repro-ing on 11.2.2:
$ docker run --rm -it python:latest bash
root@6931fdb72b42:/# cd
root@6931fdb72b42:~# pip install --user pipenv
Collecting pipenv
Downloading pipenv-11.2.2.tar.gz (4.1MB)
100% |ββββββββββββββββββββββββββββββββ| 4.1MB 294kB/s
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Collecting virtualenv (from pipenv)
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
100% |ββββββββββββββββββββββββββββββββ| 1.8MB 716kB/s
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl
Building wheels for collected packages: pipenv
Running setup.py bdist_wheel for pipenv ... done
Stored in directory: /root/.cache/pip/wheels/0c/05/ea/2c54795c34f7c6da5ea0e8013fa6dbd9efed88f02304d10eb1
Successfully built pipenv
Installing collected packages: virtualenv, virtualenv-clone, pipenv
Successfully installed pipenv-11.2.2 virtualenv-15.1.0 virtualenv-clone-0.3.0
root@6931fdb72b42:~# git clone https://github.com/maxalbert/pipenv_bug.git
Cloning into 'pipenv_bug'...
remote: Counting objects: 68, done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 68 (delta 18), reused 65 (delta 15), pack-reused 0
Unpacking objects: 100% (68/68), done.
Checking connectivity... done.
root@6931fdb72b42:~# cd pipenv_bug/
root@6931fdb72b42:~/pipenv_bug# ls -l
total 8
-rw-r--r-- 1 root root 153 Mar 10 01:59 Pipfile
-rw-r--r-- 1 root root 1787 Mar 10 01:59 Pipfile.lock
root@6931fdb72b42:~/pipenv_bug# rm Pipfile.lock
root@6931fdb72b42:~/pipenv_bug# pipenv install
bash: pipenv: command not found
root@6931fdb72b42:~/pipenv_bug# ~/.local/bin/pipenv install
Creating a virtualenv for this projectβ¦
Using /usr/local/bin/python3.6m to create virtualenvβ¦
β Running virtualenv with interpreter /usr/local/bin/python3.6m
Using base prefix '/usr/local'
New python executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python3.6m
Also creating executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python
Installing setuptools, pip, wheel...done.Virtualenv location:
Warning: Your Pipfile requires python_version 3.6, but you are using None (/bin/python).
$ pipenv check will surely fail.
Creating a virtualenv for this projectβ¦
β Using base prefix '/usr/local'
New python executable in /root/.local/share/virtualenvs/pipenv_bug-YVUDmhpZ/bin/python
Installing setuptools, pip, wheel...done.Virtualenv location:
Pipfile.lock not found, creatingβ¦
Locking [dev-packages] dependenciesβ¦
/python: not foundβ
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
It still seems to hold true. The Virtualenv location:
is still blank. However, i noticed a slight difference in error depending on where i execute python3 -m pipenv ...
.
In /
directory:
Β savilesΒ ξ°Β ~Β ξ°Β 1Β ξ°Β docker run --rm -ti fedora:27 /bin/bash
[root@82032c54d3b8 /]# pip3 install --user pipenv
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting pipenv
Downloading pipenv-11.3.1.tar.gz (4.1MB)
100% |ββββββββββββββββββββββββββββββββ| 4.1MB 400kB/s
Collecting setuptools>=36.2.1 (from pipenv)
Downloading setuptools-38.5.2-py2.py3-none-any.whl (490kB)
100% |ββββββββββββββββββββββββββββββββ| 491kB 1.7MB/s
Collecting virtualenv (from pipenv)
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
100% |ββββββββββββββββββββββββββββββββ| 1.8MB 842kB/s
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl
Installing collected packages: setuptools, virtualenv, virtualenv-clone, pipenv
Running setup.py install for pipenv ... done
Successfully installed pipenv-11.3.1 setuptools-38.5.2 virtualenv-15.1.0 virtualenv-clone-0.3.0
[root@82032c54d3b8 /]# python3 -m pipenv install requests
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Creating a virtualenv for this projectβ¦
Using /usr/bin/python3 (3.6.2) to create virtualenvβ¦
β usage: __main__.py [-h] [-p PYTHON] [-i PACKAGES] [-r REQUIREMENTS] [-d]
[-a PROJECT]
envname
__main__.py: error: the following arguments are required: envname
Virtualenv location:
Creating a Pipfile for this projectβ¦
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/root/.local/lib/python3.6/site-packages/pipenv/__main__.py", line 4, in <module>
cli()
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/root/.local/lib/python3.6/site-packages/pipenv/cli.py", line 197, in install
selective_upgrade=selective_upgrade
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 1768, in do_install
ensure_project(three=three, python=python, system=system, warn=True, deploy=deploy, skip_requirements=skip_requirements)
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 688, in ensure_project
ensure_pipfile(validate=validate, skip_requirements=skip_requirements)
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 341, in ensure_pipfile
project.create_pipfile(python=python)
File "/root/.local/lib/python3.6/site-packages/pipenv/project.py", line 410, in create_pipfile
config_parser = ConfigOptionParser(name=self.name)
File "/root/.local/lib/python3.6/site-packages/pipenv/patched/pip/baseparser.py", line 149, in __init__
assert self.name
AssertionError
In /tmp
directory:
Β savilesΒ ξ°Β ~Β ξ°Β 1Β ξ°Β docker run --rm -ti fedora:27 /bin/bash
[root@82f8a960b57f /]# pip3 install --user pipenv
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting pipenv
Downloading pipenv-11.3.1.tar.gz (4.1MB)
100% |ββββββββββββββββββββββββββββββββ| 4.1MB 424kB/s
Collecting setuptools>=36.2.1 (from pipenv)
Downloading setuptools-38.5.2-py2.py3-none-any.whl (490kB)
100% |ββββββββββββββββββββββββββββββββ| 491kB 2.1MB/s
Collecting virtualenv (from pipenv)
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
100% |ββββββββββββββββββββββββββββββββ| 1.8MB 685kB/s
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl
Installing collected packages: setuptools, virtualenv, virtualenv-clone, pipenv
Running setup.py install for pipenv ... done
Successfully installed pipenv-11.3.1 setuptools-38.5.2 virtualenv-15.1.0 virtualenv-clone-0.3.0
[root@82f8a960b57f /]# cd /tmp
[root@82f8a960b57f tmp]# python3 -m pipenv install requests
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Creating a virtualenv for this projectβ¦
Using /usr/bin/python3 (3.6.2) to create virtualenvβ¦
β Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /root/.local/share/virtualenvs/tmp-XVr6zr33/bin/python3
Also creating executable in /root/.local/share/virtualenvs/tmp-XVr6zr33/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location:
Creating a Pipfile for this projectβ¦
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/root/.local/lib/python3.6/site-packages/pipenv/__main__.py", line 4, in <module>
cli()
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/root/.local/lib/python3.6/site-packages/pipenv/cli.py", line 197, in install
selective_upgrade=selective_upgrade
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 1768, in do_install
ensure_project(three=three, python=python, system=system, warn=True, deploy=deploy, skip_requirements=skip_requirements)
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 688, in ensure_project
ensure_pipfile(validate=validate, skip_requirements=skip_requirements)
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 341, in ensure_pipfile
project.create_pipfile(python=python)
File "/root/.local/lib/python3.6/site-packages/pipenv/project.py", line 440, in create_pipfile
data[u'requires'] = {'python_version': python_version(required_python)[:len('2.7')]}
TypeError: 'NoneType' object is not subscriptable
[root@82f8a960b57f tmp]#
To add. I do not get the error and everything succeeds if i also install python2 dnf install python2
.
We fixed this in the most recent release.
I see the latest is 11.3.1 and that's what it is installing: Downloading pipenv-11.3.1.tar.gz (4.1MB)
Other things I see.
pipenv.help
before python2 install[root@f38073231340 /]# python3 -m pipenv.help
Pipenv version: '11.3.1'
Pipenv location: '/root/.local/lib/python3.6/site-packages/pipenv'
Python location: '/usr/bin/python3'
Other Python installations in PATH
:
3.6
: /usr/bin/python3.6m
3.6
: /usr/bin/python3.6
3.6
: /bin/python3.6
3.6.2
: /usr/bin/python3
3.6.2
: /bin/python3
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.6.2',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.15.6-300.fc27.x86_64',
'platform_system': 'Linux',
'platform_version': '#1 SMP Mon Feb 26 18:43:03 UTC 2018',
'python_full_version': '3.6.2',
'python_version': '3.6',
'sys_platform': 'linux'}
System environment variables:
LS_COLORS
HOSTNAME
PWD
HOME
FBR
DISTTAG
FGC
TERM
SHLVL
PATH
_
LC_CTYPE
PIP_PYTHON_PATH
PYTHONUNBUFFERED
Pipenvβspecific environment variables:
Debugβspecific environment variables:
PATH
: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD
: /
pipenv.help
after python2 install
[root@f38073231340 /]# python3 -m pipenv.help
Pipenv version: '11.3.1'
Pipenv location: '/root/.local/lib/python3.6/site-packages/pipenv'
Python location: '/usr/bin/python3'
Other Python installations in PATH
:
2.7
: /usr/bin/python2.7
2.7
: /usr/bin/python2.7
2.7
: /bin/python2.7
3.6
: /usr/bin/python3.6m
3.6
: /usr/bin/python3.6
3.6
: /bin/python3.6
2.7.14
: /usr/bin/python
2.7.14
: /bin/python
2.7.14
: /usr/bin/python2
2.7.14
: /bin/python2
3.6.2
: /usr/bin/python3
3.6.2
: /bin/python3
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.6.2',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.15.6-300.fc27.x86_64',
'platform_system': 'Linux',
'platform_version': '#1 SMP Mon Feb 26 18:43:03 UTC 2018',
'python_full_version': '3.6.2',
'python_version': '3.6',
'sys_platform': 'linux'}
System environment variables:
LS_COLORS
HOSTNAME
PWD
HOME
FBR
DISTTAG
FGC
TERM
SHLVL
PATH
_
LC_CTYPE
PIP_PYTHON_PATH
PYTHONUNBUFFERED
Pipenvβspecific environment variables:
Debugβspecific environment variables:
PATH
: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD
: /
The expected differences are really just the additional python versions in the PATH.
I know whatβs up here
@sijis can you try installing pipenv from pip install -e git+https://github.com/pypa/pipenv.git@bugfix/venv-location#egg=pipenv
That worked!
I did do pip3
vs pip
in the command you provided.
[root@7a0f010fe0f8 tmp]# python3 -m pipenv install requests
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Creating a virtualenv for this projectβ¦
Using /usr/bin/python3 (3.6.2) to create virtualenvβ¦
β Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /root/.local/share/virtualenvs/tmp-XVr6zr33/bin/python3
Also creating executable in /root/.local/share/virtualenvs/tmp-XVr6zr33/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location: /root/.local/share/virtualenvs/tmp-XVr6zr33
Creating a Pipfile for this projectβ¦
Installing requestsβ¦
Collecting requests
Downloading requests-2.18.4-py2.py3-none-any.whl (88kB)
Collecting urllib3<1.23,>=1.21.1 (from requests)
Downloading urllib3-1.22-py2.py3-none-any.whl (132kB)
Collecting chardet<3.1.0,>=3.0.2 (from requests)
Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
Collecting idna<2.7,>=2.5 (from requests)
Downloading idna-2.6-py2.py3-none-any.whl (56kB)
Collecting certifi>=2017.4.17 (from requests)
Downloading certifi-2018.1.18-py2.py3-none-any.whl (151kB)
Installing collected packages: urllib3, chardet, idna, certifi, requests
Successfully installed certifi-2018.1.18 chardet-3.0.4 idna-2.6 requests-2.18.4 urllib3-1.22
Adding requests to Pipfile's [packages]β¦
Pipfile.lock not found, creatingβ¦
Locking [dev-packages] dependenciesβ¦
Locking [packages] dependenciesβ¦
Updated Pipfile.lock (7b8df8)!
Installing dependencies from Pipfile.lock (7b8df8)β¦
π ββββββββββββββββββββββββββββββββ 5/5 β 00:00:00
To activate this project's virtualenv, run the following:
$ pipenv shell
Awesome!
:tada: we can occasionally fix things!
Hopefully I'm not hijacking this issue, but I think the case where a Pipfile needs to be created has a problem.
frege:/tmp$ docker run --rm -it python:3.6.4 bash
root@f724b64dd605:/# pip3 install -e git+https://github.com/pypa/pipenv.git@bugfix/venv-location#egg=pipenv
Obtaining pipenv from git+https://github.com/pypa/pipenv.git@bugfix/venv-location#egg=pipenv
Cloning https://github.com/pypa/pipenv.git (to bugfix/venv-location) to /src/pipenv
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Collecting virtualenv (from pipenv)
Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
100% |ββββββββββββββββββββββββββββββββ| 1.8MB 738kB/s
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading virtualenv_clone-0.3.0-py2.py3-none-any.whl
Installing collected packages: virtualenv, virtualenv-clone, pipenv
Running setup.py develop for pipenv
Successfully installed pipenv virtualenv-15.1.0 virtualenv-clone-0.3.0
root@f724b64dd605:/# pipenv install --system --verbose requests
Creating a Pipfile for this projectβ¦
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
load_entry_point('pipenv', 'console_scripts', 'pipenv')()
File "/src/pipenv/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/src/pipenv/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/src/pipenv/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/src/pipenv/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/src/pipenv/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/src/pipenv/pipenv/cli.py", line 197, in install
selective_upgrade=selective_upgrade
File "/src/pipenv/pipenv/core.py", line 1768, in do_install
ensure_project(three=three, python=python, system=system, warn=True, deploy=deploy, skip_requirements=skip_requirements)
File "/src/pipenv/pipenv/core.py", line 688, in ensure_project
ensure_pipfile(validate=validate, skip_requirements=skip_requirements)
File "/src/pipenv/pipenv/core.py", line 341, in ensure_pipfile
project.create_pipfile(python=python)
File "/src/pipenv/pipenv/project.py", line 410, in create_pipfile
config_parser = ConfigOptionParser(name=self.name)
File "/src/pipenv/pipenv/patched/pip/baseparser.py", line 149, in __init__
assert self.name
AssertionError
root@f724b64dd605:/#
frege:/tmp$ docker --version
Docker version 18.02.0-ce, build fc4de44
frege:/tmp$
don't use --system
to create pipfiles, dependency graphs can only be resolved in an isolated environment
also don't use --system
to install single packages, this is meant to be disabled but is accidentally allowed
Should there be a release before closing this bug? As I understand it, the final bug fix has not been released yet, although it has been submitted.
@darkfeline thanks for your comment, our source control workflow follows a pretty standard workflow. Fix gets merged, issue gets closed. Issue closure isn't tied to release schedule.
I am still seeing this issue on python:3.6 docker. Is there a fix released, or a quick fix a user can do?
Step 1/6 : FROM python:3.6
---> efb6baa1169f
Step 2/6 : RUN python -m pip install pipenv
---> Running in 44264bb4020b
Collecting pipenv
Downloading https://files.pythonhosted.org/packages/ed/a3/6c51d36006a563798021f954fd10a9baeb9592f8dabbb162ff0595e309cf/pipenv-11.10.3-py3-none-any.whl (6.4MB)
Requirement already satisfied: pip>=9.0.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Collecting certifi (from pipenv)
Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
Collecting virtualenv (from pipenv)
Downloading https://files.pythonhosted.org/packages/ed/ea/e20b5cbebf45d3096e8138ab74eda139595d827677f38e9dd543e6015bdf/virtualenv-15.2.0-py2.py3-none-any.whl (2.6MB)
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading https://files.pythonhosted.org/packages/6d/c2/dccb5ccf599e0c5d1eea6acbd058af7a71384f9740179db67a9182a24798/virtualenv_clone-0.3.0-py2.py3-none-any.whl
Installing collected packages: certifi, virtualenv, virtualenv-clone, pipenv
Successfully installed certifi-2018.4.16 pipenv-11.10.3 virtualenv-15.2.0 virtualenv-clone-0.3.0
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Removing intermediate container 44264bb4020b
---> 4a3bf7062e88
Step 3/6 : RUN python -m pipenv shell
---> Running in 27d9a362d4c3
Creating a virtualenv for this projectβ¦
Using /usr/local/bin/python (3.6.5) to create virtualenvβ¦
usage: __main__.py [-h] [-p PYTHON] [-i PACKAGES] [-r REQUIREMENTS] [-d]
[-a PROJECT]
envname
__main__.py: error: the following arguments are required: envname
Virtualenv location:
Creating a Pipfile for this projectβ¦
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/site-packages/pipenv/__main__.py", line 4, in <module>
cli()
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/cli.py", line 607, in shell
three=three, python=python, fancy=fancy, shell_args=shell_args
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 2143, in do_shell
ensure_project(three=three, python=python, validate=False)
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 650, in ensure_project
ensure_pipfile(validate=validate, skip_requirements=skip_requirements, system=system)
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 304, in ensure_pipfile
project.create_pipfile(python=python)
File "/usr/local/lib/python3.6/site-packages/pipenv/project.py", line 571, in create_pipfile
config_parser = ConfigOptionParser(name=self.name)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/pip9/baseparser.py", line 149, in __init__
assert self.name
AssertionError
I am tring to install dependencies, but even a pipenv shell
from fresh doesn't seem to work for me.
@cmac4603 you can't run pipenv shell
before you've ever installed anything. I don't see how your issue relates to this one, please either include all relevant details or open a new issue.
@techalchemy It looks like the same issue mentioned here, get the same error with install using the official python3.6 docker container:
Sending build context to Docker daemon 1.475MB
Step 1/10 : FROM python:3.6
---> efb6baa1169f
Step 2/10 : ARG APP_VERSION=
---> Using cache
---> 40ec63b9c926
Step 3/10 : ENV APP_VERSION=$APP_VERSION
---> Using cache
---> 285cd6d436c0
Step 4/10 : COPY Pipfile .
---> 0ed53c675b25
Step 5/10 : COPY Pipfile.lock .
---> a2ace18ad13a
Step 6/10 : RUN python -m pip install --no-cache-dir pipenv
---> Running in f9e9bb00ab7b
Collecting pipenv
Downloading https://files.pythonhosted.org/packages/ac/49/b95f5a1d5e1a0bbdb42ac96c19927a4af7b067aecefc1b6eeefbe4e3706c/pipenv-11.10.4-py3-none-any.whl (6.4MB)
Requirement already satisfied: pip>=9.0.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Collecting virtualenv (from pipenv)
Downloading https://files.pythonhosted.org/packages/ed/ea/e20b5cbebf45d3096e8138ab74eda139595d827677f38e9dd543e6015bdf/virtualenv-15.2.0-py2.py3-none-any.whl (2.6MB)
Collecting certifi (from pipenv)
Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading https://files.pythonhosted.org/packages/6d/c2/dccb5ccf599e0c5d1eea6acbd058af7a71384f9740179db67a9182a24798/virtualenv_clone-0.3.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.6/site-packages (from pipenv)
Installing collected packages: virtualenv, certifi, virtualenv-clone, pipenv
Successfully installed certifi-2018.4.16 pipenv-11.10.4 virtualenv-15.2.0 virtualenv-clone-0.3.0
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Removing intermediate container f9e9bb00ab7b
---> a405f412349f
Step 7/10 : RUN python -m pipenv install
---> Running in 7792bdfd14a4
Creating a virtualenv for this projectβ¦
Using /usr/local/bin/python3.6m (3.6.5) to create virtualenvβ¦
usage: __main__.py [-h] [-p PYTHON] [-i PACKAGES] [-r REQUIREMENTS] [-d]
[-a PROJECT]
envname
__main__.py: error: the following arguments are required: envname
Virtualenv location:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/site-packages/pipenv/__main__.py", line 4, in <module>
cli()
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/cli.py", line 402, in install
selective_upgrade=selective_upgrade,
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 1781, in do_install
skip_requirements=skip_requirements,
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 625, in ensure_project
path_to_python = which('python') or which('py')
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 128, in which
p = os.sep.join([location] + ['bin/{0}'.format(command)])
TypeError: sequence item 0: expected str instance, NoneType found
The command '/bin/sh -c python -m pipenv install' returned a non-zero code: 1
I think I actually have a vague idea why this is happening. It is basically the same as the /bin/python
path problem, and is probably related to system encoding. I donβt have any interest in digging into this, however, as I do not use Docker at all. I can probably point you where to look if anyone is interested. Just hit me with an email of ping me on PySlackers.
looks to me like the issue is that you are trying to do this from /
and you never made an app directory which breaks things, we just need a better error message
@techalchemy
looks to me like the issue is that you are trying to do this from / and you never made an app directory which breaks things, we just need a better error message
Can you explain exactly what the resolution here is supposed to be? I tried adding
WORKDIR /app/
into my dockerfile, but when I tried to install the dependencies with pipenv using a requirements.txt
file, it said the folder was not found.
Here's what my folder set up is:
rlittles@rlittles-linux1 (/home/rlittles/git_projects/pixel-mask-gen) (158018408-automate-bad-pixel-mask-generation) $ tree
.
βββ 20180619-kb26_bpm.fits
βββ config.yml
βββ debug
βΒ Β βββ 0_bpm.txt
βΒ Β βββ 1_bpm.txt
βΒ Β βββ 20180619-kb26_bpm.fits.txt
βΒ Β βββ 2_bpm.txt
βΒ Β βββ combined_bpm_list.txt
βββ Dockerfile
βββ instructions.pdf
βββ LICENSE
βββ README.md
βββ requirements.txt
βββ script.py
βββ src
βΒ Β βββ combine_images.py
βΒ Β βββ create_bpm.py
βΒ Β βββ fitsutils.py
βΒ Β βββ statistics.py
βββ test
βΒ Β βββ __init__.py
βΒ Β βββ test_script.py
βββ TODO.md
and here's my Dockerfile:
FROM python:3
WORKDIR /app/
ADD script.py /
RUN pip install pipenv
RUN pipenv --three
RUN pipenv install -r app/requirements.txt
CMD ["pipenv", "run", "python3", "app/script.py", "app/config.yml"]
The way I run my script locally is just python3 script.py config.yml
, and my dependencies are stored in the requirements.txt
file. How do I follow your instructions to be able to:
1) Initialize a virtual environment in Python using pipenv
2) Install the already-defined dependencies listed in requirements.txt
so that I can use pipenv to execute my Python script in the virtual environment.
Thanks in advance.
In docker containers, you are not intended to deploy a requirements.txt
file or to use a virtual environment. Since a docker container is an isolated environment itself, you no longer need the extra layer of isolation.
You need to start by converting your requirements.txt
to a pipenv environment locally in order to generate a Pipfile.lock
-- please see the documentation.
Based on the Dockerfile
it seems like you are just getting started with both docker and pipenv at the same time -- you need to ADD
each file that will be needed in the docker container, including a Pipfile.lock
and your entire application. See the docker documentation for help on docker keywords, but you'll need to find a tutorial on deploying python applications in docker containers for more general guidance.
The WORKDIR
command changes your directory inside the container. so if you then pipenv install -r app/<something>
when you have already set WORKDIR /app/
you are not likely to be successful, since you are asking pipenv to install /app/app/<something>
.
Once you have docker and pipenv working independently, you should then read pipenv documentation on deploying system dependencies which includes a bit of information about what you want to pass inside a docker environment.
@techalchemy
Thanks for being patient and giving a thorough explanation! I was able to get my Docker file running correctly independent of pipenv. Unfortunately I am not able to use pipenv locally due to issue #2125 but that is a separate topic and so I will not address it on this thread.
I'll make sure to review the documentation for docker that you recommended, and thanks again for the help.
Most helpful comment
I am still seeing this issue on python:3.6 docker. Is there a fix released, or a quick fix a user can do?
I am tring to install dependencies, but even a
pipenv shell
from fresh doesn't seem to work for me.