Cannot install modules using pip - it gives an error - python-3.x

I uninstalled Python 3.8 and then installed Python 3.9.
Now, when I try to install any module using pip:
pip install pygame
It shows this error:
ERROR: Command errored out with exit status 1:
command: 'c:\users\acer\appdata\local\programs\python\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Acer\\AppData\\Local\\Temp\\pip-install-s3fy0toj\\pygame\\setup.py'"'"'; __file__='"'"'C:\\Users\\Acer\\AppData\\Local\\Temp\\pip-install-s3fy0toj\\pygame\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Acer\AppData\Local\Temp\pip-pip-egg-info-lgmfm8yh'
cwd: C:\Users\Acer\AppData\Local\Temp\pip-install-s3fy0toj\pygame\
Complete output (17 lines):
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x64"? [Y/n]Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Acer\AppData\Local\Temp\pip-install-s3fy0toj\pygame\setup.py", line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\Acer\AppData\Local\Temp\pip-install-s3fy0toj\pygame\buildconfig\config.py", line 210, in main
deps = CFG.main(**kwds)
File "C:\Users\Acer\AppData\Local\Temp\pip-install-s3fy0toj\pygame\buildconfig\config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\Acer\AppData\Local\Temp\pip-install-s3fy0toj\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I tried uninstalling and installing Python again, but still no luck. I had no problem like this when I was using Python 3.8
When I tried installing Django, it worked but then I tried installing Pandas and it did not work.
Please help.

I think there are some compatibility issues with python3.9.
For more information,you can check this link.
https://github.com/pygame/pygame/issues/2145

Related

cannot import name '_jsonl' from partially initialized module 'jsonl'

I am trying to install the python jsonl module on an Ubuntu system. Tried on two different computers and get the same exact error:
pip install jsonl
Collecting jsonl
Downloading jsonl-1.6.tar.gz (9.0 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5lw5f9ew/jsonl/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5lw5f9ew/jsonl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-5lw5f9ew/jsonl/pip-egg-info cwd: /tmp/pip-install-5lw5f9ew/jsonl/
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-5lw5f9ew/jsonl/setup.py", line 5, in <module>
import jsonl
File "/tmp/pip-install-5lw5f9ew/jsonl/jsonl/__init__.py", line 19, in <module>
from jsonl import _jsonl as jsonl
ImportError: cannot import name '_jsonl' from partially initialized module 'jsonl' (most likely due to a circular import) (/tmp/pip-install-5lw5f9ew/jsonl/jsonl/__init__.py)
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Any ides on how to fix this? As the same exact error occurs on two systems, I'm thinking it's a config error on my part, but no idea on how to resolve. Thanks!
jsonl, the latest version 1.6 was released in 2014. I can install it with Python 2.7 but not with Python 3. The bottom line: it's an outdated abandoned project, forget it.
Another problem: it requires simplejson but doesn't declare it as a dependency.

Cannot install uwsgi thru pip install uwsgi using pycharms in Windows 10

Getting an error installing uWsgi using pycharms. I do not have Linux and most of the solutions I saw are using Linux. Any advice?
Executed command:
pip install uwsgi
Error occurred:
ERROR: Command errored out with exit status 1:
Command output:
Collecting uwsgi
Using cached uWSGI-2.0.19.1.tar.gz (803 kB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Sherman\Selenium\video_code\venv\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Sherman\\AppData\\Local\\Temp\\pip-install-kmyfu2dr\\uwsgi_af87984b16b348968367e4dff1c9d244\\setup.py'"'"'; __file__='"'"'C:\\Users\\Sherman\\AppData\\Local\\Temp\\pip-install-kmyfu2dr\\uwsgi_af87984b16b348968367e4dff1c9d244\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Sherman\AppData\Local\Temp\pip-pip-egg-info-1cos39nx'
cwd: C:\Users\Sherman\AppData\Local\Temp\pip-install-kmyfu2dr\uwsgi_af87984b16b348968367e4dff1c9d244\
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Sherman\AppData\Local\Temp\pip-install-kmyfu2dr\uwsgi_af87984b16b348968367e4dff1c9d244\setup.py", line 3, in <module>
import uwsgiconfig as uc
File "C:\Users\Sherman\AppData\Local\Temp\pip-install-kmyfu2dr\uwsgi_af87984b16b348968367e4dff1c9d244\uwsgiconfig.py", line 8, in <module>
uwsgi_os = os.uname()[0]
AttributeError: module 'os' has no attribute 'uname'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
To make it work on windows 10, you will have to build uWSGI package by modifying some of its setup. Replacing os with platform
Alternatively, you can try waitress or uvicorn. Which work well in windows.

Installing Rtree from libspacialindex to use .clip() in geopandas

I am attempting to install rtree on my macOS machine running python3.7.7. In the geopandas documentation, it indicates that macos installs ddo not include "binary wheels" (not sure what this means honestly) for rtree.
I followed the instructions on the website https://libspatialindex.org/#download and installed the packages using cmake. When I go to my terminal in VScode and run the command
python3 -m pip install rtree rtree is downloaded, but it fails to install yielding the error message:
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/setup.py'"'"'; __file__='"'"'/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/pip-egg-info
cwd: /private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/
Complete output (15 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/setup.py", line 3, in <module>
import rtree
File "/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/rtree/__init__.py", line 1, in <module>
from .index import Rtree
File "/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/rtree/index.py", line 6, in <module>
from . import core
File "/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/rtree/core.py", line 143, in <module>
rt.Error_GetLastErrorNum.restype = ctypes.c_int
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 377, in __getattr__
func = self.__getitem__(name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 382, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Steps taken to resolve:
- installed postgresql via homebrew as suggested by previous answers to similar questions
I installed the libspacialindex stuff in the same directory as my project. Is this where the problem is? Am I missing some crucial package needed for this?
Any help is greatly appreciated, let me know if you require more info.
First install spatialindex via brew, then rtree via pip:
brew install spatialindex
pip install rtree

Unable to install wsgiref in python 3.x

I can't install wsgiref in python 3. I got these errors.
I am using python 3, but I can't install wsgiref
I tried pip install wsgiref and pip install wsgiref==0.1.2
E:\CodeWork\Machine Learning\SWATI-The-Assistant-master\SWATI-The-Assistant-master>pip install wsgiref==0.1.2
Collecting wsgiref==0.1.2
Using cached https://files.pythonhosted.org/packages/41/9e/309259ce8dff8c596e8c26df86dbc4e848b9249fd36797fd60be456f03fc/wsgiref-0.1.2.zip
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-h2ydr_0e\\wsgiref\\setup.py'"'"'; __file__='"'"'C:\\Users\\hp\\AppData\\Local\\Temp\\pip-install-h2ydr_0e\\wsgiref\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\hp\AppData\Local\Temp\pip-install-h2ydr_0e\wsgiref\pip-egg-info'
cwd: C:\Users\hp\AppData\Local\Temp\pip-install-h2ydr_0e\wsgiref\
Complete output (8 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\hp\AppData\Local\Temp\pip-install-h2ydr_0e\wsgiref\setup.py", line 5, in <module>
import ez_setup
File "C:\Users\hp\AppData\Local\Temp\pip-install-h2ydr_0e\wsgiref\ez_setup\__init__.py", line 170
print "Setuptools version",version,"or greater has been installed."
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Setuptools version",version,"or greater has been installed.")?
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.```
The reason the pip 3 install is erroring is the syntax of one of the print statements in the setup process is old python 2 style with no parentheses. The good news is that wsgiref is already included in the python 3 library by default. Fire up a python 3 shell and try typing 'import wsgiref', that should succeed with no error.

install pymssql and cython fails on Mac OSX

I have python project. In the project i have requirements.txt file. while trying to install dependency from requirements file i am getting below error. I am using mac machine, python 3.6, Cython==0.29.3,pymssql==2.1.4
ERROR: Command errored out with exit status 1:
command: /Users/user_name/.virtualenvs/test/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/rz/f3lsfyh154s_r7fggcqx57q80000gp/T/pip-install-bz2kcaud/pymssql/setup.py'"'"'; __file__='"'"'/private/var/folders/rz/f3lsfyh154s_r7fggcqx57q80000gp/T/pip-install-bz2kcaud/pymssql/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /private/var/folders/rz/f3lsfyh154s_r7fggcqx57q80000gp/T/pip-install-bz2kcaud/pymssql/
Complete output (7 lines):
/Users/user_name/.virtualenvs/test/lib/python3.6/site-packages/setuptools/dist.py:45: DistDeprecationWarning: Do not call this function
warnings.warn("Do not call this function", DistDeprecationWarning)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/rz/f3lsfyh154s_r7fggcqx57q80000gp/T/pip-install-bz2kcaud/pymssql/setup.py", line 88, in <module>
from Cython.Distutils import build_ext as _build_ext
ModuleNotFoundError: No module named 'Cython'
ERROR: Command errored out with exit status 1: python setup.py
egg_info Check the logs for full command output.
Able to figure out below are the steps,
brew install freetds
Then try to install requirements.txt file.
If still getting errors then follow . . the below steps.
pip install cython
pip install pymssql
then again try to install requirements.txt file.

Resources