Score:1

python virtual environment with different python version than system python and installing packages

ua flag

I created a python 3.9.7 virtual environment using virtualenv. This is a different python version than my system python. When I try install jupyter via pip install jupyter I get the following error:

Traceback (most recent call last):
  File "/usr/bin/Python-3.9.7/Lib/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/bin/Python-3.9.7/Lib/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/__main__.py", line 16, in <module>
    from pip._internal.cli.main import main as _main  # isort:skip # noqa
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
    from pip._internal.exceptions import CommandError
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/_internal/exceptions.py", line 10, in <module>
    from pip._vendor.six import iteritems
ModuleNotFoundError: No module named 'pip._vendor.six'

How can I fix this?

Thank you!

N0rbert avatar
zw flag
Using `/usr/bin/Python-3.9.7` folder for local python is bad idea. Use `/usr/local` or `/opt` for such things. Instead use https://github.com/pyenv/pyenv .
kdbaseball8 avatar
ua flag
can you explain maybe a little more why it is a bad idea?
N0rbert avatar
zw flag
1. This folder is maintained by APT, 2. you break FHS by creating directories here.
kdbaseball8 avatar
ua flag
ah thank you! Good to know!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.