Due to a series of events described later I am getting the following error in the command prompt whenever I try to do anything with pip.
(venv) (base) C:\Users\Mark Kortink\Dropbox\Python\projects\metapplica>pip install flask
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\MARKKO~1\Dropbox\Python\projects\METAPP~1\venv\Scripts\pip.exe\__main__.py", line 9, in <module>
File "c:\users\markko~1\dropbox\python\projects\metapp~1\venv\lib\site-packages\pip\_internal\main.py", line 45, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "c:\users\markko~1\dropbox\python\projects\metapp~1\venv\lib\site-packages\pip\_internal\commands\__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "C:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\users\markko~1\dropbox\python\projects\metapp~1\venv\lib\site-packages\pip\_internal\commands\install.py", line 23, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "c:\users\markko~1\dropbox\python\projects\metapp~1\venv\lib\site-packages\pip\_internal\cli\req_command.py", line 17, in <module>
from pip._internal.index import PackageFinder
ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (c:\users\markko~1\dropbox\python\projects\metapp~1\venv\lib\site-packages\pip\_internal\index\__init__.py)
All the circumstances are described in my other question which didn't get a useful answer. It is here ModuleNotFoundError.
I a nutshell: -
- I had an working app in Flask running in an Anaconda environment with everything installed using pip (not conda), it used flask-bootstrap.
- I uninstalled flask-bootstrap and installed a different package Bootsrap-flask to get bootstrap-4, it worked.
- I uninstalled Bootstrap-flask because I decided to go pure CSS.
- I can still run my app from the Anaconda environment in its venv using "flask run".
- But as soon as I try and run anything flask related in a debugger (Spyder or VSCode) i get that core Flask libraries cannot be found.
- And as soon as I do anything with pip I get the above error.
I believe all the detail above is a distraction, I have incuded it for completeness and it is covered in my other linked question. I believe the root cause should be apparent from the above read-out from the command prompt. In particular ImportError: cannot import name 'PackageFinder' from 'pip._internal.index'
Can anyone suggest anything. If not how do I safely and cleanly remove my Flask venv environment and reinstall it without losing anything.
Thanks