cannot use pip in python virtualenv - python

I created a virtualenv named proj_env and activated in the command prompt of Windows as follows:
C:\Users\me\Desktop\loan_predictor\proj_env\Scripts>activate.bat
(proj_env) C:\Users\me\Desktop\loan_predictor\proj_env\Scripts>pip3 install flask
Traceback (most recent call last):
File "D:\Python\Python35\Lib\runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "D:\Python\Python35\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\me\Desktop\loan_predictor\proj_env\Scripts\pip3.exe\__main__.py", line 5, in <module>
ImportError: No module named 'pip._internal'
I am not sure why both pip and pip3 doesn't work, although it worked when I did pip3 install virtualenv.
What am I missing?

Related

vitualenv does not work for my 2.7.9 python installation

After installing:
pip install virtualenv
Running it yells:
C:\programs\python\Python27\Scripts>virtualenv.exe
Traceback (most recent call last):
File "C:\programs\python\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\programs\python\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\programs\python\Python27\Scripts\virtualenv.exe\__main__.py", line 5, in <module>
File "C:\programs\python\Python27\lib\site-packages\virtualenv\__init__.py", line 3, in <module>
from .run import cli_run, session_via_cli
File "C:\programs\python\Python27\lib\site-packages\virtualenv\run\__init__.py", line 7, in <module>
from ..app_data import make_app_data
File "C:\programs\python\Python27\lib\site-packages\virtualenv\app_data\__init__.py", line 9, in <module>
from platformdirs import user_data_dir
ImportError: No module named platformdirs
Any ideas why this is happening ?
pip 1.5.6

Python build package error- 'virtualenv' has no attribute 'cli_run'

Using Azure Databricks to build a python package. Received the following error from command:
python3 -m build
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/databricks/python3/lib/python3.7/site-packages/build/__main__.py", line 214, in <module>
main(sys.argv[1:], 'python -m build')
File "/databricks/python3/lib/python3.7/site-packages/build/__main__.py", line 206, in main
build_package(args.srcdir, outdir, distributions, config_settings, not args.no_isolation, args.skip_dependencies)
File "/databricks/python3/lib/python3.7/site-packages/build/__main__.py", line 94, in build_package
_build_in_isolated_env(builder, outdir, distributions, config_settings)
File "/databricks/python3/lib/python3.7/site-packages/build/__main__.py", line 52, in _build_in_isolated_env
with IsolatedEnvBuilder() as env:
File "/databricks/python3/lib/python3.7/site-packages/build/env.py", line 65, in __enter__
executable, scripts_dir = _create_isolated_env_virtualenv(self._path)
File "/databricks/python3/lib/python3.7/site-packages/build/env.py", line 156, in _create_isolated_env_virtualenv
result = virtualenv.cli_run(cmd, setup_logging=False)
AttributeError: module 'virtualenv' has no attribute 'cli_run'
I was able to solve the same issue (although in an AWS environment) by upgrading pip and virtualenv:
python3 -m pip install --upgrade pip virtualenv

checking the version of chatter using python -m chatterbot --version.This is the error

python -m chatterbot --version
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/opt/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/anaconda3/lib/python3.7/site-packages/chatterbot/main.py", line 20, in
print(get_chatterbot_version())
File "/opt/anaconda3/lib/python3.7/site-packages/chatterbot/main.py", line 15, in get_chatterbot_version
return config['chatterbot']['version']
File "/opt/anaconda3/lib/python3.7/configparser.py", line 958, in getitem
raise KeyError(key)
KeyError: 'chatterbot'
probably this will work for you:
git clone https://github.com/gunthercox/ChatterBot.git
python3 setup.py install
Sources:
https://github.com/gunthercox/ChatterBot/issues/1940
Hope it help, have a nice day,
David.

Errors in installing django module for python

I've been trying to install django, looked around the internet but couldn't find possible solution for this.
I have tried looking for solutions. Some solutions told me to install conflict checker for pip but it still did not work because nothing seems to be getting installed using 'pip' keyword. It even gives me error when I try to find out my pip version
python -m pip install django
PS C:\Users\Fahad> python -m pip install django
Traceback (most recent call last):
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\__init__.py", line 19, in
from pip._vendor.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.urllib3
PS C:\Users\Fahad> python -m pip --version
Traceback (most recent call last):
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "C:\Users\Fahad\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.urllib3'
So I tried downloading get-pip.py from here and hen I executed python get-pip.py then I tried re-installing django and it worked.

Problems upgrading Ipython (prompt_toolkit incompatibilities)

Trying to open a jupyter notebook file (.ipynb file)
with this command ipython notebook filename.ipynb then I am getting Below Error while using ipython..
Traceback (most recent call last):
File "c:\python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python\Scripts\ipython.exe\__main__.py", line 5, in <module>
File "c:\python\lib\site-packages\IPython\__init__.py", line 55, in <module>
from .terminal.embed import embed
File "c:\python\lib\site-packages\IPython\terminal\embed.py", line 16, in
<module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "c:\python\lib\site-packages\IPython\terminal\interactiveshell.py",
line 18, in <module>
from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
ModuleNotFoundError: No module named 'prompt_toolkit'
Just got the same problem.
The solution for me was to pip uninstall prompt-toolkit and pip install prompt-toolkit. This uninstalled v1.0.5 and installed v2.0.4.

Categories

Resources