Quantcast
Viewing all articles
Browse latest Browse all 5995

Using Poetry with PyEnv and having Python version issues

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:

  1. pyenv install 3.10.0
  2. cd to my project folder and pyenv local 3.10.0 (creates .python-version file containing 3.10.0)
  3. poetry shell (this creates a .venv folder and all dependencies are added there during development). Bash Prompt has (.venv) in it.
  4. 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.8lrwxrwxrwx 1 mryan mryan   18 Feb  1 23:12 python -> /usr/bin/python3.8lrwxrwxrwx 1 mryan mryan    6 Feb  1 23:12 python3 -> pythonlrwxrwxrwx 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.10python3.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.


Viewing all articles
Browse latest Browse all 5995

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>