Reputation: 5855
I have read various other similar questions without finding one that matches my issue. Feel free to redirect me if I have missed one.
I have Python 3.10.7 installed on my system (Arch Linux) and I need to work on an older project that uses Python 3.6.9.
I know this project works with 3.6.9 and its dependencies are correctly installed because I can see it running fine in a docker container that I have entered to check the version of Python.
As I have tried that several times I make sure to start again with a fresh environment with:
pipenv --rm
rm Pipfile
Then I do:
pipenv --python 3.6.9
Python 3.6.9 is installed with Pyenv successfully and so is the virtual environment.
If I do pipenv shell
then python --version
is Python 3.6.9
as expected. Then I Ctrl-D
to get out of the environment.
I then do pipenv install -r requirements.txt
and that crashes with the following traceback:
Requirements file provided! Importing into Pipfile...
Pipfile.lock not found, creating...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/pipenv/resolver.py", line 867, in <module>
main()
File "/usr/lib/python3.10/site-packages/pipenv/resolver.py", line 844, in main
from pipenv.vendor.vistir.misc import replace_with_text_stream
File "/usr/lib/python3.10/site-packages/pipenv/__init__.py", line 58, in <module>
from .cli import cli
File "/usr/lib/python3.10/site-packages/pipenv/cli/__init__.py", line 1, in <module>
from .command import cli # noqa
File "/usr/lib/python3.10/site-packages/pipenv/cli/command.py", line 7, in <module>
from pipenv.cli.options import (
File "/usr/lib/python3.10/site-packages/pipenv/cli/options.py", line 3, in <module>
from pipenv.project import Project
File "/usr/lib/python3.10/site-packages/pipenv/project.py", line 2
from __future__ import annotations
^
SyntaxError: future feature annotations is not defined
Correct me if I'm wrong, I understand that the installation is using Python 3.10 here while the code is expected to be run with 3.6 where annotations is in future.
What did I do wrong?
Upvotes: 5
Views: 2776
Reputation: 262
you can make sure you have specifiled the correct python ver in your pip file with:
pipenv --py
it should show path to the correct python executable
and if you still having problem try to del your pip.lock and reinstalling the package you can do this by :
pipenv lock --clear
following by pipenv install
Upvotes: 0
Reputation: 720
Its better if you use the respective piping version for python 3.6
and add that in your requirements.txt file.
pipenv==2018.11.26
You can refer to this doc and also this
Upvotes: 1
Reputation: 635
Python 3.6 support was dropped by pipenv on 2022.4.20
. Please check the pipenv version on your docker container if you're using an older version of pipenv in it.
Upvotes: 2