I'm working on WSL2 Ubuntu. I've been taking a course in backend API development using Fastapi. My Ubuntu default python is 3.8 I believe. I'm trying to use python 3.10.0 for my development. I've done the following:
- pyenv install 3.10.0
- cd to my project folder and pyenv local 3.10.0 (creates .python-version file containing 3.10.0)
- poetry shell (this creates a .venv folder and all dependencies are added there during development). Bash Prompt has (.venv) in it.
- python --version shows 3.10.0 as current version
My problem is that when I look into the .venv/bin file, all of the symbolic links show python 3.8.
drwxr-xr-x 2 mryan mryan 4096 Feb 1 23:12 .
drwxr-xr-x 4 mryan mryan 4096 Feb 1 23:12 ..
-rw-r--r-- 1 mryan mryan 2152 Feb 1 23:12 activate
-rw-r--r-- 1 mryan mryan 1444 Feb 1 23:12 activate.csh
-rw-r--r-- 1 mryan mryan 3033 Feb 1 23:12 activate.fish
-rw-r--r-- 1 mryan mryan 1303 Feb 1 23:12 activate.nu
-rw-r--r-- 1 mryan mryan 1754 Feb 1 23:12 activate.ps1
-rw-r--r-- 1 mryan mryan 1199 Feb 1 23:12 activate_this.py
-rw-r--r-- 1 mryan mryan 333 Feb 1 23:12 deactivate.nu
-rwxr-xr-x 1 mryan mryan 249 Feb 1 23:12 pip
-rwxr-xr-x 1 mryan mryan 249 Feb 1 23:12 pip-3.8
-rwxr-xr-x 1 mryan mryan 249 Feb 1 23:12 pip3
-rwxr-xr-x 1 mryan mryan 249 Feb 1 23:12 pip3.8
lrwxrwxrwx 1 mryan mryan 18 Feb 1 23:12 python -> /usr/bin/python3.8
lrwxrwxrwx 1 mryan mryan 6 Feb 1 23:12 python3 -> python
lrwxrwxrwx 1 mryan mryan 6 Feb 1 23:12 python3.8 -> python
-rwxr-xr-x 1 mryan mryan 236 Feb 1 23:12 wheel
-rwxr-xr-x 1 mryan mryan 236 Feb 1 23:12 wheel-3.8
-rwxr-xr-x 1 mryan mryan 236 Feb 1 23:12 wheel3
-rwxr-xr-x 1 mryan mryan 236 Feb 1 23:12 wheel3.8
When I try using the command poetry env use 3.10.0 I get the following:
(.venv) mryan ~/python/fastapi1/.venv/bin $poetry env use 3.10.0
/bin/sh: 1: python3.10: not found
EnvCommandError
Command python3.10 -c "import sys; print('.'.join([str(s) for s in sys.version_info[:3]]))" errored with the following return code 127, and output:
at ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/env.py:378 in activate
374│ shell=True,
375│ )
376│ )
377│ except CalledProcessError as e:
→ 378│ raise EnvCommandError(e)
379│
380│ python_version = Version.parse(python_version.strip())
381│ minor = "{}.{}".format(python_version.major, python_version.minor)
382│ patch = python_version.text
(.venv) mryan ~/python/fastapi1/.venv/bin $python3.10
python3.10: command not found
What am I doing wrong here? I feel I'm missing something significant here. I've been through a zillion web pages on poetry and virtual environments.
poetry
are you using? – Colton