pipenv: Unable to create a new pipenv powered project on Windows
Issue description
When trying to set up a new project in pipenv, it is unable to find the scripts dir from the virtual environment
Expected result
Create new virtual environment and create Pipfile for project.
Actual result
$ pipenv install boto3
Creating a virtualenv for this project…
Pipfile: E:\ScriptDir\Generic\test\Pipfile
Using C:/Users/nick.perkins/AppData/Local/Programs/Python/Python37/python.exe (3.7.4) to create virtualenv…
[ ] Creating virtual environment...Already using interpreter C:\Users\nick.perkins\AppData\Local\Programs\Python\Python37\python.exe
Using base prefix 'C:\\Users\\nick.perkins\\AppData\\Local\\Programs\\Python\\Python37'
New python executable in C:\Users\nick.perkins\.virtualenvs\test-9QO8X7jI\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter C:/Users/nick.perkins/AppData/Local/Programs/Python/Python37/python.exe
Successfully created virtual environment!
Virtualenv location: C:\Users\nick.perkins\.virtualenvs\test-9QO8X7jI
Creating a Pipfile for this project…
Traceback (most recent call last):
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\nick.perkins\AppData\Local\Programs\Python\Python37\Scripts\pipenv.exe\__main__.py", line 9, in <module>
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\cli\command.py", line 252, in install
site_packages=state.site_packages
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 1929, in do_install
site_packages=site_packages,
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 615, in ensure_project
validate=validate, skip_requirements=skip_requirements, system=system
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 320, in ensure_pipfile
project.create_pipfile(python=python)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\project.py", line 753, in create_pipfile
required_python = self.which("python", self.virtualenv_location)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\project.py", line 1126, in which
result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\project.py", line 1126, in <genexpr>
result = next(iter(filter(None, (find(finder) for finder in self.finders))), None)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 134, in which
return self.system_path.which(exe)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 483, in which
return next(iter(f for f in filtered if f is not None), None)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 483, in <genexpr>
return next(iter(f for f in filtered if f is not None), None)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 482, in <genexpr>
filtered = (sub_which(self.get_path(k)) for k in self.path_order)
File "c:\users\nick.perkins\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 438, in get_path
raise ValueError("Path not found or generated: {0!r}".format(path))
ValueError: Path not found or generated: WindowsPath('c:/users/nick.perkins/.virtualenvs/test-9qo8x7ji/scripts')
Steps to replicate
Provide the steps to replicate (which usually at least includes the commands and the Pipfile).
pipenv install boto3
No Pipfile was createdpipenv
$ pipenv --support
Pipenv version: '2020.6.2'
Pipenv location: 'c:\\users\\nick.perkins\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\pipenv'
Python location: 'c:\\users\\nick.perkins\\appdata\\local\\programs\\python\\python37\\python.exe'
Python installations found:
3.7.4
:C:\Users\nick.perkins\AppData\Local\Programs\Python\Python37\python.exe
3.7.2
:C:\Users\nick.perkins\.pyenv\pyenv-win\versions\3.7.2\python.exe
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.7.4',
'os_name': 'nt',
'platform_machine': 'AMD64',
'platform_python_implementation': 'CPython',
'platform_release': '10',
'platform_system': 'Windows',
'platform_version': '10.0.14393',
'python_full_version': '3.7.4',
'python_version': '3.7',
'sys_platform': 'win32'}
System environment variables:
ACLOCAL_PATH
ALLUSERSPROFILE
APPDATA
AWS_PROFILE
CLIENTNAME
COMMONPROGRAMFILES
COMPUTERNAME
COMSPEC
CONFIG_SITE
COMMONPROGRAMFILES(X86)
COMMONPROGRAMW6432
DISPLAY
EXEPATH
HOME
HOMEDRIVE
HOMEPATH
HOSTNAME
INFOPATH
LANG
LOCALAPPDATA
LOGONSERVER
MANPATH
MINGW_CHOST
MINGW_PACKAGE_PREFIX
MINGW_PREFIX
MSYSTEM
MSYSTEM_CARCH
MSYSTEM_CHOST
MSYSTEM_PREFIX
NUMBER_OF_PROCESSORS
OLDPWD
ORIGINAL_PATH
ORIGINAL_TEMP
ORIGINAL_TMP
OS
PATH
PATHEXT
PKG_CONFIG_PATH
PLINK_PROTOCOL
PROCESSOR_ARCHITECTURE
PROCESSOR_IDENTIFIER
PROCESSOR_LEVEL
PROCESSOR_REVISION
PROGRAMFILES
PS1
PSMODULEPATH
PUBLIC
PWD
PYENV
PROGRAMDATA
PROGRAMFILES(X86)
PROGRAMW6432
SESSIONNAME
SHELL
SHLVL
SSH_ASKPASS
SYSTEMDRIVE
SYSTEMROOT
TEMP
TERM
TMP
TMPDIR
USERDNSDOMAIN
USERDOMAIN
USERDOMAIN_ROAMINGPROFILE
USERNAME
USERPROFILE
WINDIR
_
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONDONTWRITEBYTECODE
PIP_SHIMS_BASE_MODULE
PIP_PYTHON_PATH
PYTHONFINDER_IGNORE_UNSUPPORTED
PipenvÔÇôspecific environment variables:
DebugÔÇôspecific environment variables:
PATH
:C:\Users\nick.perkins\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\nick.perkins\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Amazon\cfn-bootstrap;C:\Program Files\Git\cmd;C:\Program Files\7-Zip;C:\Program Files\TortoiseGit\bin;C:\Program Files\Amazon\AWSCLIV2;C:\Users\nick.perkins\.pyenv\pyenv-win\bin;C:\Users\nick.perkins\.pyenv\pyenv-win\shims;C:\Users\nick.perkins\AppData\Local\Programs\Python\Python37\Scripts;C:\Users\nick.perkins\AppData\Local\Programs\Python\Python37;C:\Users\nick.perkins\AppData\Local\Microsoft\WindowsApps;C:\Users\nick.perkins\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
SHELL
:C:\Program Files\Git\usr\bin\bash.exe
LANG
:en_US.UTF-8
PWD
:E:/ScriptDir/Generic/test
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 15
- Comments: 25 (3 by maintainers)
is there a known workaround to this?
UPDATE: roll back to 2018.11.26 release (https://pypi.org/project/pipenv/2018.11.26/)
@Timtam this has been fixed in the upstream version which haven’t been released yet. You can install the latest version from git:
pip install -e git+https://github.com/pypa/pipenv.git
Or patch your local installation with the fixes in the pull request.
@frostming any idea when a new version will be released?
update your virtualenv pipenv pip install pipenv==2018.11.26 this works for me
I needed to specify the egg name to pull the latest version
pip install -e git+https://github.com/pypa/pipenv.git#egg=pipenv
@rfkortekaas Thanks, that is enlightening. I have addressed it in the upstream. https://github.com/sarugaku/pythonfinder/pull/89
@frostming some path entries are setup with
normalize_path
frompipenv\pythonfinder\utils.py
. This function uses normcase and normpath. On windows this changes forward slashes to backward slashes. Where as_posix returns the path with forward slashes. It took me a long time the track down the issue and I ended up with removingnormcase
fromnormalize_path
what basically results in the same as the solution from @meichthys.The issue only occurs when one of the
_setup_*
functions are called. So it looks like the path_order with the wrong formatting is coming form thenew_instances
created in the_setup_*
functions.Same issue here, can’t actually use pipenv. Going back to the 2018.11.26 version does allow me to pip install inside my project folder.
Sorry to bring this up again, but I’m running into the same issues right now.
Here is the installed pipenv version:
Is there no way to solve this except going back to a two-year old version by now? Thanks.
This resolved my problem, thanks a bunch!
+1 had this same problem