pipenv requires python 3.7 but installed version is 3.8 and won't install

May 2024 · 4 minute read

I know a little of Python and more than a year ago I wrote a small script, using pipenv to manage the dependencies.

The old platform was Windows 7, the current platform is Windows 10.

At that time I probably had Python 3.7 installed, now I have 3.8.3 but running:

pipenv install 

Complained that:

Warning: Python 3.7 was not found on your system… Neither 'pyenv' nor 'asdf' could be found to install Python. You can specify specific versions of Python with: $ pipenv --python path\to\python 

This is the Pipfile

[[source]] url = "https://pypi.org/simple" verify_ssl = true name = "pypi" [packages] python-ldap = {path = "./dependencies/python_ldap-3.1.0-cp37-cp37m-win_amd64.whl"} requests = "~=2.0" mysqlclient = "~=1.0" [dev-packages] [requires] python_version = "3.7" 

I manually edited that last line to allow 3.8, but how do I properly fix that?
I think 3.7 should be a minimum requirement — well, the script is so simple that I think even 3.0 should work.

1

7 Answers

[requires] python_version = "3.7" 

and the error:

Warning: Python 3.7 was not found on your system…

Sort of hints that pipenv is installed but when it reads your config file, it sees that it should create environment with python 3.7, So, logically, you should install 3.7 or update the pipfile to use the python you have installed ?

I would recommend you to install pyenv (so it can manage your Python versions).

The repository of pyenv is this one: https://github.com/pyenv/pyenv

With pyenv installed when a Pipfile requires a version of Python that you do not have on your machine it will ask if you want to install it with pyenv. In this way you'll be able to work in projects with different python versions without having to worry about which version the project is using. With pyenv you can easily change between python version in your global shell as well.

Another suggestion not really realated to your question is, you should take a look on poetry to replace pipenv (it is faster because it install the dependencies in a async way), the website for poetry is this one: https://python-poetry.org/

But still, you will need something like pyenv or install another python version manually to solve your problem.

If you just wanna make the Pipfile allow you to use newer versions of python I guess you can change it like this:

[[source]] url = "https://pypi.org/simple" verify_ssl = true name = "pypi" [packages] python-ldap = {path = "./dependencies/python_ldap-3.1.0-cp37-cp37m-win_amd64.whl"} requests = "~=2.0" mysqlclient = "~=1.0" [dev-packages] [requires] python_version = "^3.7" 

I'm not really sure if the syntax is ^3.7 or >=3.7 but should be one of this two.

If your python command is Python 2.x, but you have a python3 command which runs Python 3.x, then you might just need to use the --python option to tell pipenv to use it:

$ pipenv install Warning: Python >= 3.5 was not found on your system... Neither 'pyenv' nor 'asdf' could be found to install Python. You can specify specific versions of Python with: $ pipenv --python path/to/python $ pipenv --python `which python3` install Creating a virtualenv for this project... 

You can download Python 3.7 from the official site - https://www.python.org/downloads/

4

The simple solution is, you can avoid such a problem and make it a fully system dependable python version. To make this happen, just remove python_version = "3.7" line from requires.

[[source]] url = "https://pypi.org/simple" verify_ssl = false name = "pypi" [packages] [dev-packages] [requires] python_version = "3.7" 

So after removing the python version, your pipfile would be like,

[[source]] url = "https://pypi.org/simple" verify_ssl = false name = "pypi" [packages] [dev-packages] [requires] python_version = "*" 
1

I have Python 3.9 installed,

and pipenv requires Python 3.6 as stated in pipfile.

So, I change the value in pipfile

[requires] python_version = "3.6" 

to

[requires] python_version = "*" 

so it can be work on any version.

1

Install Relevant version

How to check Python Version

cmd any directory>Python -v

In My case they need Python 3.8.2 But i have Python 3.8.0 version installed Due this i could not able over come this error

Once i install exact version i can able to run command

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobWxqZGyFcX%2BOqaCpnZ6rerOx0K6gq52jYr26wMeopWZrXWx6o8HTZqCnq6SWua2xw2atnqqjnryvecisZGxlaGKur7CMsKanrF2eu7TAwKWj