I have python 3.8 & 3.9 and 3.10 and 3.11 installed, however pip install does not work for 3.10 and 3.11 and only works for the rest simply please observe:
pip3 install jedi
returns:
Requirement already satisfied: jedi in /home/user/.local/lib/python3.8/site-packages (0.17.2)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in /home/user/.local/lib/python3.8/site-packages (from jedi) (0.7.1)
so does:
pip install jedi
returns
Requirement already satisfied: jedi in /home/user/.local/lib/python3.8/site-packages (0.17.2)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in /home/user/.local/lib/python3.8/site-packages (from jedi) (0.7.1)
as well as :
python3.8 -m pip install jedi
results in:
Requirement already satisfied: jedi in /home/c/.local/lib/python3.8/site-packages (0.17.2)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in /home/c/.local/lib/python3.8/site-packages (from jedi) (0.7.1)
However
python3.10 -m pip install jedi
results in :
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pip/__main__.py", line 19, in <module>
sys.exit(_main())
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 15, in <module>
from pip._internal.index.package_finder import PackageFinder
File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 21, in <module>
from pip._internal.index.collector import parse_links
File "/usr/lib/python3/dist-packages/pip/_internal/index/collector.py", line 12, in <module>
from pip._vendor import html5lib, requests
ImportError: cannot import name 'html5lib' from 'pip._vendor' (/usr/lib/python3/dist-packages/pip/_vendor/__init__.py)
Python versions are managed by alternatives
update-alternatives --query python
which returns:
Name: python
Link: /usr/bin/python
Status: auto
Best: /usr/bin/python3.8
Value: /usr/bin/python3.8
Alternative: /usr/bin/python3.8
Priority: 80
and
update-alternatives --query python3
returns:
Name: python3
Link: /usr/bin/python3
Status: auto
Best: /usr/bin/python3.8
Value: /usr/bin/python3.8
Alternative: /usr/bin/python3.10
Priority: 40
Alternative: /usr/bin/python3.8
Priority: 90
I tried re-installing practically everything including python versions and the modules to no avail.
I am not too sure what is the root of the problem or actually what is the process that leads here, it only does
It's always best to run the pip as a main module with the version of Python you want to install for.
python3.9 -m pip install ...
python3.10 -m pip install ...
python3.11 -m pip install ...
If you want to force an upgrade, use the --upgrade option.
First try to install pygames
PS > py -m pip install pygames
ERROR: Could not find a version that satisfies the requirement
pygames (from versions: none)
ERROR: No matching distribution found for pygames
There is a version conflict. I have many Python versions (2.4 - 3.11) on Windows 11.
py laucher defaults to highest Python version installed.
=> specify py launcher option -xx.yy-ZZ like:
(More info: py --help)
PS > py -3.7-32 -m pip install -U pygame
Collecting pygame
Downloading pygame-2.1.2-cp37-cp37m-win32.whl (8.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
8.1/8.1 MB 1.2 MB/s
Installing collected packages: pygame
Successfully installed pygame-2.1.2
PS > py -3.7-32
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
'>>> from pygame import *'
'>>>'
Happy end!
Related
PIP3 does not install!
Meanwhile i was setting my vps i tried to install python3 thorugh repositories and it did worked but i wasn't lucky for pip3. please help.
I got this:
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 22, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 73, in <module>
vendored("pkg_resources")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 33, in vendored
__import__(modulename, globals(), locals(), level=0)
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 77, in <module>
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/packaging/requirements.py", line 9, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/extern/__init__.py", line 43, in load_module
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py", line 943, in <module>
AttributeError: module 'collections' has no attribute 'MutableMapping'
I did this:
sudo apt update
sudo apt install python3-pip
pip3 -V
Try running this:
pip3 install --upgrade pip3
pip3 install --upgrade wheel
pip3 install --upgrade setuptools
pip3 install --upgrade requests
should fix it
I've got a poetry project. My environment is Conda 22.9.0 on a windows machine with poetry version 1.2.2:
This is my pyproject.toml file:
[tool.poetry]
name = "myproject"
version = "0.1.0"
description = ""
[tool.poetry.dependencies]
# REVIEW DEPENDENCIES
python = ">=3.7,<3.11"
numpy = "*"
tensorflow = "^2.8"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
[tool.poetry.scripts]
start = "myproject.main:start"
The myproject\main.py module contains:
import tensorflow as tf
def start():
if tf.test.is_gpu_available():
print("TensorFlow is using a GPU.")
else:
print("TensorFlow is NOT using a GPU.")
If I do poetry install, it seems to work fine:
Creating virtualenv myproject in D:\Projects\myproject\dev\myproject-series-forecast\.venv
Updating dependencies
Resolving dependencies...
Writing lock file
Package operations: 41 installs, 0 updates, 0 removals
• Installing certifi (2022.12.7)
• Installing charset-normalizer (2.1.1)
• Installing idna (3.4)
• Installing pyasn1 (0.4.8)
• Installing urllib3 (1.26.13)
• Installing cachetools (5.2.0)
• Installing oauthlib (3.2.2)
• Installing rsa (4.9)
• Installing six (1.16.0)
• Installing zipp (3.11.0)
• Installing requests (2.28.1)
• Installing pyasn1-modules (0.2.8)
• Installing google-auth (2.15.0)
• Installing importlib-metadata (5.2.0)
• Installing requests-oauthlib (1.3.1)
• Installing markupsafe (2.1.1)
• Installing absl-py (1.3.0)
• Installing grpcio (1.51.1)
• Installing numpy (1.21.6)
• Installing tensorboard-data-server (0.6.1)
• Installing markdown (3.4.1)
• Installing tensorboard-plugin-wit (1.8.1)
• Installing protobuf (3.19.6)
• Installing werkzeug (2.2.2)
• Installing google-auth-oauthlib (0.4.6)
• Installing astunparse (1.6.3)
• Installing flatbuffers (22.12.6)
• Installing gast (0.4.0)
• Installing google-pasta (0.2.0)
• Installing h5py (3.7.0)
• Installing keras (2.11.0)
• Installing tensorflow-estimator (2.11.0)
• Installing packaging (22.0)
• Installing opt-einsum (3.3.0)
• Installing libclang (14.0.6)
• Installing tensorboard (2.11.0)
• Installing tensorflow-io-gcs-filesystem (0.29.0)
• Installing termcolor (2.1.1)
• Installing typing-extensions (4.4.0)
• Installing wrapt (1.14.1)
• Installing tensorflow (2.11.0)
Installing the current project: myproject (0.1.0)
But when executing poetry run start I got error in import
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Python\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "D:\Projects\myproject\dev\myproject-series-forecast\myproject\main.py", line 3, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
When I type "pip install PyDictionary" I reserve this error. I also tryed installing the package by typing "python(3) -m pip install PyDictionary" I installed this package before without problems with (python 3.10) but not o n python 3.10.64
enter code here
PS C:\Users\danie\Desktop\pythonProject> pip install PyDictionary
Collecting PyDictionary
Using cached PyDictionary-2.0.1-py3-none-any.whl (6.1 kB)
Collecting goslate
Using cached goslate-1.5.2-py3-none-any.whl
Requirement already satisfied: requests in c:\users\danie\appdata\local\programs\python\python310\lib\site-packages (from PyDictionary) (2.27.1)
Requirement already satisfied: click in c:\users\danie\appdata\local\programs\python\python310\lib\site-packages (from PyDictionary) (8.0.4)
Collecting bs4
Using cached bs4-0.0.1-py3-none-any.whl
Requirement already satisfied: beautifulsoup4 in c:\users\danie\appdata\local\programs\python\python310\lib\site-packages (from bs4->PyDictionary) (4.10.0)
Requirement already satisfied: colorama in c:\users\danie\appdata\local\programs\python\python310\lib\site-packages (from click->PyDictionary) (0.4.4)
Collecting futures
Using cached futures-3.0.5.tar.gz (25 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [25 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 14, in <module>
File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\__init__.py", line 18, in <module>
from setuptools.dist import Distribution
File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py", line 32, in <module>
from setuptools.extern.more_itertools import unique_everseen
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 674, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\extern\__init__.py", line 52, in create_module
return self.load_module(spec.name)
File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\extern\__init__.py", line 37, in load_module
__import__(extant)
File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_vendor\more_itertools\__init__.py", line 1, in <module>
from .more import * # noqa
File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_vendor\more_itertools\more.py", line 5, in <module>
from concurrent.futures import ThreadPoolExecutor
File "C:\Users\danie\AppData\Local\Temp\pip-install-cvmk7t7g\futures_bc0e05fe70bf443a80089b769091bce8\concurrent\futures\__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "C:\Users\danie\AppData\Local\Temp\pip-install-cvmk7t7g\futures_bc0e05fe70bf443a80089b769091bce8\concurrent\futures\_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
There's an open issue on the repo currently: I'll attach the link here but give a quick explanation.
https://github.com/geekpradd/PyDictionary/issues/52
There's a dependency for the google translate aspect of the package that depends on Python 2 code. That's causing the package to fail to install on Python 3.10+ (In the dependency repo they explicitly declare that it won't work on Python 3+).
One of the answerers on the github issue said he found a workaround by installing futures before attempting to install PyDictionary
I am getting the below error while i am trying for "pip install rasa". My Python Version is 3.7.8.
Error message :
Requirement already satisfied: python-dateutil<2.9,>=2.8 in c:\users\loginname\desktop\2020\chatbot\venv\lib\site-packages (from rasa) (2.8.1)
Collecting colorhash<1.1.0,>=1.0.2
Using cached colorhash-1.0.2-py2.py3-none-any.whl (6.0 kB)
Collecting ujson<3.0,>=1.35
Using cached ujson-2.0.3.tar.gz (7.1 MB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\loginname\desktop\2020\chatbot\venv\scripts\python.exe' 'c:\users\loginname\desktop\2020\chatbot\venv\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\loginname\AppData\Local\Temp\pip-build-env-nir8n2vw\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
cwd: None
Complete output (42 lines):
Traceback (most recent call last):
File "C:\Users\loginname\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\loginname\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\users\loginname\desktop\2020\chatbot\venv\lib\site-packages\pip\__main__.py", line 26, in <module>
sys.exit(_main())
File "c:\users\loginname\desktop\2020\chatbot\venv\lib\site-packages\pip\_internal\cli\main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "c:\users\loginname\desktop\2020\chatbot\venv\lib\site-packages\pip\_internal\commands\__init__.py", line 104, in create_command
module = importlib.import_module(module_path)
File "C:\Users\loginname\AppData\Local\Programs\Python\Python37\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
$ sudo apt install python3-dev python3-pip
$ python3 -m venv ./venv
$ source ./venv/bin/activate
$ pip install -U pip
$ pip install rasa
https://rasa.com/docs/rasa/user-guide/installation/
I've got a Mac which has python installed and virtualenvwrapper installed. I'm trying to create a new environment by running:
mkvirtualenv Test
To which I get the following error:
New python executable in /Users/sidharthnayyar/.virtualenvs/Test/bin/python
Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Library/Python/2.7/site-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
from stevedore import ExtensionManager
ImportError: No module named stevedore
I have python installed here:
$ which -a python
/usr/local/bin/python
/usr/bin/python
If I try sudo pip install stevedore then it says its already installed with some warnings:
sudo /usr/local/bin/pip install stevedore
The directory '/Users/sidharthnayyar/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/sidharthnayyar/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): stevedore in ./Library/Python/2.7/lib/python/site-packages
Requirement already satisfied (use --upgrade to upgrade): pbr>=1.6 in /Library/Python/2.7/site-packages (from stevedore)
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in ./Library/Python/2.7/lib/python/site-packages (from stevedore)
If I try sudo -H pip install stevedore then I get the following errors:
sudo -H /usr/local/bin/pip install stevedore
Collecting stevedore
Using cached stevedore-1.18.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): pbr>=1.6 in /Library/Python/2.7/site-packages (from stevedore)
Collecting six>=1.9.0 (from stevedore)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, stevedore
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-NOex2K-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
If I create a .bash_profile and put into it:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
and reload a terminal window then I get the following error:
source ~/.bash_profile
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Library/Python/2.7/site-packages/virtualenvwrapper/hook_loader.py", line 16, in <module>
from stevedore import ExtensionManager
ImportError: No module named stevedore
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python and that PATH is
set properly.
Curious and curiouser.
Any suggestions on what's going wrong and how to fix this?
Thanks
Sidharth
I was very confused with this problem, too. And I have solved it by uninstalling the old stevedore and reinstall it.
sudo pip uninstall stevedore
sudo pip install stevedore
Looks like you managed to install virtualwrapper without stevedore, which is a dependency. Try installing it.
pip install stevedore
with python 2.7 sudo pip install stevedore