Pipenv Install Locking Failed!no Module Named 'json'
Solution 1:
What fixed it for me was adding the following to my system environment variables:
In Windows:
setx /M PIPENV_VENV_IN_PROJECT 1
This will force pipenv to create a ".venv" directory in your project folder instead of the default "virtualenvs" in your user profile directory (this part is what is breaking "pipenv install"). It will also give you the proper ".venv" directory and file structure that corresponds to the way pipenv creates it instead of the way "python -m venv .venv" creates it. From what I've seen, the structures are different.
More information about this issue can be found at the following URL: https://github.com/pypa/pipenv/issues/1382
If you want this same result in Linux, set the variable with the following command:
export PIPENV_VENV_IN_PROJECT=1
Solution 2:
Thanks to bryan, bryan reminded me,when I choice a new folder and run pipenv shell
[ ] Creating virtual environment...Already using interpreter c:\users\hank\appdata\local\programs\python\python36\python.exe
Using base prefix 'c:\\users\\hank\\appdata\\local\\programs\\python\\python36'
New python executable in C:\Users\hank\.virtualenvs\hankspace-spEtL83E\Scripts\python.exe
Command C:\Users\hank\.virtua...E\Scripts\python.exe -m pip config list had error code 1
Installing setuptools, pip, wheel...
Complete output from command C:\Users\hank\.virtua...E\Scripts\python.exe - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>ModuleNotFoundError: No module named 'pkgutil'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\pipenv\cli\command.py", line 390, in shell
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=state.pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 2156, in do_shell
[pipenv.exceptions.VirtualenvCreationException]: three=three, python=python, validate=False, pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 506, in ensure_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]: File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 935, in do_create_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: extra=[crayons.blue("{0}".format(c.err)),]
[pipenv.exceptions.VirtualenvCreationException]: Traceback (most recent call last):
File "c:\users\hank\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\hank\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 2567, in <module>
main()
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 793, in main
symlink=options.symlink,
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 1088, in create_environment
install_wheel(to_install, py_executable, search_dirs, download=download)
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 935, in install_wheel
_install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 1025, in _install_wheel_with_search_dir
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 886, in call_subprocess
raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
OSError: Command C:\Users\hank\.virtua...E\Scripts\python.exe - setuptools pip wheel failed with error code 1
Failed to create virtual environment.
Then I found this problem can be traced to virtualenv,Finally I found this post https://itqna.net/questions/16455/problems-trying-create-virtual-environment-pipenv solved my problem
python -m venv .venv
pipenv shell
pipenv install
it worked!
Solution 3:
Based on the commands and traceback you shared did you actually create and enter your environment? (pipenv shell)
I ran into a similar issue with it failing to lock after installing packages and it turned out that I had 64-bit and 32-bit Python installed and it was causing conflicts. To fix it, I deleted the 32-bit (Start Menu -> Settings -> Apps) then deleted the virtual environment that I had already created. Navigate to C:\Users\.virtualenvs then delete the folder with the name of your environment. Now you can navigate back to your folder and create the pipenv environment again by calling pipenv shell.
Solution 4:
Try the following command:
python36ana.exe -m pipenv --python3.6
Post a Comment for "Pipenv Install Locking Failed!no Module Named 'json'"