Reputation: 95
I tried using pyenv(pyenv-win) with pipenv in python. i installed some of the versions of python using pyenv but when am trying to create a virtual environment using the one of the versions which i have installed through pyenv. pipenv is not able to pickup the python versions from pyenv.
pipenv --python 3.10.6
C:\Users\MUZUB\test1>pipenv --python 3.10.6
Warning: Python 3.10.6 was not found on your system...
Would you like us to install CPython 3.10.6 with Pyenv? [Y/n]: n
Installed Pyenv Python Versions :
C:\Users\MUZUB>pyenv versions
3.10.6
3.10.7
3.11.0rc2
3.6.0
3.7.1
3.7.2
3.8.1
3.9.2
3.9.5
* 3.9.9 (set by C:\Users\MUZUB\.pyenv\pyenv-win\version)
My default python version is 3.11
C:\Users\MUZUB\test1>python
Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
when i don't specify a specific version of python .pipenv is using my default python installation to create a virtual environment.
C:\Users\MUZUB\test1>pipenv shell
Creating a virtualenv for this project...
Pipfile: C:\Users\MUZUB\test1\Pipfile
Using C:/Users/MUZUB/Desktop/python311/python.exe (3.11.1) to create virtualenv...
[ ] Creating virtual environment...created virtual environment CPython3.11.1.final.0-64 in 4715ms
creator Venv(dest=C:\Users\MUZUB\.virtualenvs\test1-y9ytVeDV, clear=False, no_vcs_ignore=False, global=False, describe=CPython3Windows)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\MUZUB\AppData\Local\pypa\virtualenv)
added seed packages: pip==22.3.1, setuptools==65.6.3, wheel==0.38.4
activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Successfully created virtual environment!
Virtualenv location: C:\Users\MUZUB\.virtualenvs\test1-y9ytVeDV
requirements.txt found in C:\Users\MUZUB instead of Pipfile! Converting...
Warning: Your Pipfile now contains pinned versions, if your requirements.txt did.
We recommend updating your Pipfile to specify the "*" version, instead.
Launching subshell in virtual environment...
Microsoft Windows [Version 10.0.22621.963]
(c) Microsoft Corporation. All rights reserved.
User Environment variables:
PYENV C:\Users\MUZUB\.pyenv\pyenv-win\
PYENV_HOME C:\Users\MUZUB\.pyenv\pyenv-win\
PYENV_ROOT C:\Users\MUZUB\.pyenv\pyenv-win\versions
Path:
C:\Users\MUZUB\Desktop\python311
C:\Users\MUZUB\Desktop\python311\Scripts
C:\Users\MUZUB\.pyenv\pyenv-win\shims
C:\Users\MUZUB\.pyenv\pyenv-win\bin
C:\Users\MUZUB\.pyenv\pyenv-win\versions
I have tried changing priority in path.but it doesn't work.
iam expecting the python versions installed with pyenv be available to pipenv.
Edits:
i have tried passing the full path as well.
C:\Users\MUZUB\Desktop\pipy>pipenv --python C:\Users\MUZUB\.pyenv\pyenv-win\versions\3.7.1
Usage: pipenv [OPTIONS] COMMAND [ARGS]...
Try 'pipenv -h' for help.
Error: Invalid value for '--python': Expected Python at path C:\Users\MUZUB\.pyenv\pyenv-win\versions\3.7.1 does not exist
C:\Users\MUZUB\Desktop\pipy>pipenv --python C:\\Users\\MUZUB\\.pyenv\\pyenv-win\\versions\\3.7.1
Usage: pipenv [OPTIONS] COMMAND [ARGS]...
Try 'pipenv -h' for help.
Error: Invalid value for '--python': Expected Python at path C:\\Users\\MUZUB\\.pyenv\\pyenv-win\\versions\\3.7.1 does not exist
C:\Users\MUZUB\Desktop\pipy>pipenv --python C:/Users/MUZUB/.pyenv/pyenv-win/versions/3.7.1
Usage: pipenv [OPTIONS] COMMAND [ARGS]...
Try 'pipenv -h' for help.
Error: Invalid value for '--python': Expected Python at path C:/Users/MUZUB/.pyenv/pyenv-win/versions/3.7.1 does not exist
i cant see bin directory as well in the python versions i installed with pyenv.
C:\Users\MUZUB\.pyenv\pyenv-win\versions\3.10.6>dir
Volume in drive C is OS
Volume Serial Number is BCEC-821A
Directory of C:\Users\MUZUB\.pyenv\pyenv-win\versions\3.10.6
15-12-2022 17:38 <DIR> .
15-12-2022 17:58 <DIR> ..
01-08-2022 22:00 19,256 api-ms-win-core-console-l1-1-0.dll
01-08-2022 22:00 18,744 api-ms-win-core-datetime-l1-1-0.dll
01-08-2022 22:00 18,744 api-ms-win-core-debug-l1-1-0.dll
01-08-2022 22:00 18,744 api-ms-win-core-errorhandling-l1-1-0.dll
01-08-2022 22:00 22,328 api-ms-win-core-file-l1-1-0.dll
01-08-2022 22:00 18,744 api-ms-win-core-file-l1-2-0.dll
01-08-2022 22:00 18,744 api-ms-win-core-file-l2-1-0.dll
01-08-2022 22:00 18,744 api-ms-win-core-handle-l1-1-0.dll
01-08-2022 22:00 19,256 api-ms-win-core-heap-l1-1-0.dll
01-08-2022 22:00 18,744 api-ms-win-core-interlocked-l1-1-0.dll
01-08-2022 22:00 19,256 api-ms-win-core-libraryloader-l1-1-0.dll
01-08-2022 22:00 21,304 api-ms-win-core-localization-l1-2-0.dll
01-08-2022 22:00 19,256 api-ms-win-core-memory-l1-1-0.dll
01-08-2022 22:00 18,744 api-ms-win-core-namedpipe-l1-1-0.dll
01-08-2022 22:00 19,768 api-ms-win-core-processenvironment-l1-1-0.dll
01-08-2022 22:00 20,792 api-ms-win-core-processthreads-l1-1-0.dll
01-08-2022 22:00 19,256 api-ms-win-core-processthreads-l1-1-1.dll
01-08-2022 22:00 18,232 api-ms-win-core-profile-l1-1-0.dll
01-08-2022 22:00 19,256 api-ms-win-core-rtlsupport-l1-1-0.dll
01-08-2022 22:00 18,744 api-ms-win-core-string-l1-1-0.dll
01-08-2022 22:00 20,792 api-ms-win-core-synch-l1-1-0.dll
01-08-2022 22:00 19,256 api-ms-win-core-synch-l1-2-0.dll
01-08-2022 22:00 19,768 api-ms-win-core-sysinfo-l1-1-0.dll
01-08-2022 22:00 18,744 api-ms-win-core-timezone-l1-1-0.dll
01-08-2022 22:00 17,856 api-ms-win-core-util-l1-1-0.dll
01-08-2022 22:00 19,768 api-ms-win-crt-conio-l1-1-0.dll
01-08-2022 22:00 22,840 api-ms-win-crt-convert-l1-1-0.dll
01-08-2022 22:00 19,256 api-ms-win-crt-environment-l1-1-0.dll
01-08-2022 22:00 20,792 api-ms-win-crt-filesystem-l1-1-0.dll
01-08-2022 22:00 19,768 api-ms-win-crt-heap-l1-1-0.dll
01-08-2022 22:00 19,256 api-ms-win-crt-locale-l1-1-0.dll
01-08-2022 22:00 27,064 api-ms-win-crt-math-l1-1-0.dll
01-08-2022 22:00 26,936 api-ms-win-crt-multibyte-l1-1-0.dll
01-08-2022 22:00 71,480 api-ms-win-crt-private-l1-1-0.dll
01-08-2022 22:00 19,768 api-ms-win-crt-process-l1-1-0.dll
01-08-2022 22:00 22,464 api-ms-win-crt-runtime-l1-1-0.dll
01-08-2022 22:00 24,888 api-ms-win-crt-stdio-l1-1-0.dll
01-08-2022 22:00 24,888 api-ms-win-crt-string-l1-1-0.dll
01-08-2022 22:00 21,304 api-ms-win-crt-time-l1-1-0.dll
01-08-2022 22:00 19,256 api-ms-win-crt-utility-l1-1-0.dll
15-12-2022 17:38 <DIR> DLLs
15-12-2022 17:38 <DIR> Doc
15-12-2022 17:38 <DIR> include
15-12-2022 17:38 <DIR> Lib
15-12-2022 17:38 <DIR> libs
01-08-2022 22:00 32,763 LICENSE.txt
01-08-2022 22:00 1,273,168 NEWS.txt
01-08-2022 21:59 101,800 python.exe
01-08-2022 21:59 520,192 python.pdb
01-08-2022 21:59 101,800 python3.10.exe
01-08-2022 21:59 64,936 python3.dll
01-08-2022 21:59 101,800 python3.exe
01-08-2022 22:00 4,493,736 python310.dll
01-08-2022 21:59 101,800 python310.exe
01-08-2022 22:00 15,077,376 python310.pdb
01-08-2022 22:00 9,964,032 python310_d.dll
01-08-2022 22:00 11,243,520 python310_d.pdb
01-08-2022 22:00 68,608 python3_d.dll
01-08-2022 21:59 100,264 pythonw.exe
01-08-2022 22:00 536,576 pythonw.pdb
01-08-2022 21:59 100,264 pythonw3.10.exe
01-08-2022 21:59 100,264 pythonw3.exe
01-08-2022 21:59 100,264 pythonw310.exe
01-08-2022 22:00 135,168 pythonw_d.exe
01-08-2022 22:00 684,032 pythonw_d.pdb
01-08-2022 22:00 137,216 python_d.exe
01-08-2022 22:00 667,648 python_d.pdb
15-12-2022 17:38 <DIR> Scripts
15-12-2022 17:38 <DIR> tcl
15-12-2022 17:38 <DIR> Tools
01-08-2022 22:00 1,001,272 ucrtbase.dll
01-08-2022 22:00 98,736 vcruntime140.dll
01-08-2022 22:00 38,304 vcruntime140_1.dll
65 File(s) 47,708,339 bytes
10 Dir(s) 481,290,395,648 bytes free
Upvotes: 1
Views: 1478
Reputation: 6199
Here are a few things you can try to resolve this issue:
Make sure that you have added the pyenv directory to your PATH environment variable. This will allow pipenv to find the Python versions that you have installed with pyenv.
If you are using the pyenv-win plugin, make sure that you have added the pyenv-win shim to your PATH environment variable. This shim allows you to use pyenv commands in your Windows command prompt.
Try specifying the full path to the Python executable when creating the virtual environment. For example: pipenv --python /path/to/python.
If you are using pipenv with a specific project, try using the --python flag to specify the Python executable to use for the virtual environment. For example: pipenv --python /path/to/python install
.
Upvotes: 2
Reputation: 21
Hey the problem is that you are referencing the relative path of the python installation under pyenv.
You should try absolute path to python installation under pyenv:
pipenv --python C:\\Users\\MUZUB\\.pyenv\\pyenv-win\\versions\\3.10.0
Upvotes: 2