Error while trying to install 'pymongo' libary - python

I tried to run my code on Linux ad get this error:
ModuleNotFoundError: No module named 'pymongo'
then I install with these commands :
$ pip install pymongo
$ pip install pymongo==2.1.1
$ pip install --upgrade pymongo
and still get an error :
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pymongo/
I've tried to search this error - specific on 'pynomgo' and couldn't find anything.
I'd be happy if anyone can help me here.
thank you in advance.

Please do check your internet connection.
Because the error says read timed out which meant there is a problem in internet connectivity.
If you still can't resolve the problem Please tell which OS you are using.
Because in linux based OS pymongo will be pre-installed.

Related

Problem when installing Python from source, SSL package missing even though openssl installed

The Problem
Trying to install Python-3.11.1 from source on Zorin OS (Ubuntu16 based) I get the following errors when I try to pip install any package into a newly created venv:
python3.11 -m venv venv
source venv/bin/active
pip install numpy
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement numpy (from versions: none)
ERROR: No matching distribution found for numpy
Obviously, the SSL package seems to be missing, however I made sure to have both openssl and libssl-dev installed before installing python. More specifically, I made sure to have all packages installed lined out here.
The Exact Steps I Took To Install
Make sure all packages that are required are installed (the once above)
cd .../python-installs
Download Python from python.org
tar -xvzf Python-3.11.1.tgz
cd Python-3.11.1 and then
./configure \
--prefix=/opt/python/3.11.1 \
--enable-shared \
--enable-optimizations \
--enable-ipv6 \
--with-openssl=/usr/lib/ssl \
--with-openssl-rpath=auto \
LDFLAGS=-Wl,-rpath=/opt/python/3.11.1/lib,--disable-new-dtags
make <- Note that I get a lot off error messages from gcc here, very similar to this, however it seems its successful at the end
make altinstall
Parts of this installation process are from [1], [2]
Running python3.11 seems to work fine, however I cannot pip install anything into a venv created by Python3.11.1.
Other Possible Error Sources
Before trying to reinstall Python3.11.1, I always made sure to delete all files in the following places that were associated with Python3.11.1:
/usr/local/bin/...
/usr/local/lib/...
/usr/local/man/man1/...
/usr/local/share/man/man1/...
/usr/local/lib/pkgconfig/...
/opt/python/...
I also tried adding Python-3.11.1 to PATH by adding
PATH=/opt/python/3.11.1/bin:$PATH
to /etc/profile.d/python.sh, but it didn't seem to do much in my case.
When configuring the python folder I am using --with-openssl=/usr/lib/ssl, though perhaps I need to use something else? I tried --with-openssl=/usr/bin/openssl but that doesn't work because openssl is a file and not a folder and it gives me an error message and doesn't even configure anything.
Conclusion
From my research I found that most times this error relates to the openssl library not being installed (given that python versions >= 3.10 will need it to be installed), and that installing it and reinstalling python seemed to fix the issue. However in my case it doesn't, and I don't know why that is.
The most likely cause is that something is wrong with my openssl configuration, but I wouldn't know what.
Any help would be greatly appreciated.
After some more research, I realized that I didn't have libbz2-dev installed, which is obviously the first thing one should check if they get the errors above but oh well. For anyone who still finds himself struggling, here are my complete steps I took:
Make sure the following libraries are installed
apt show libbz2-dev
apt show openssl
apt show libssl-dev
# Other libraries that might also be needed
apt show liblzma-dev
cd .../python-installs
Download the target Python version from python.org as Gzipped tar ball
tar -xvzf Python-3.11.1.tgz
sudo mkdir opt/python
sudo mkdir opt/python/3.11.1
cd Python-3.11.1 and then
./configure --prefix=/opt/python/3.11.1 \
--enable-optimizations
make <- Note that I still get a lot of error messages from gcc, also get a always_inline not in line error message
sudo make altinstall
Add PATH=/opt/python/3.11.1/bin:$PATH to the file /etc/profile.d/python.sh
reboot
Then to test if the error is gone one can for example test:
python3.11 -m venv venv
source venv/bin/active
pip install pandas
python3.11
import pandas
exit()
If there are no errors then everything worked out. Obviously the version needs to be changed to the actual target version of yours.
Note
If you your newly installed python version does not appear in terminal, it might be because the file /etc/profile.d/python.sh already existed with the Path to the python version (for example, if you had to install it multiple times). In that case, delete the file (or at least the PATH to the target version) and then recreate it. After rebooting it should appear in terminal.

How to fix Python PIP update failing

I am trying to install and use python on Windows 11 for purposes of Meraki API calls. I have installed Python version 3.11 and am now trying to run
pip install --upgrade requests
pip install --upgrade meraki
but these command return the following error
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/requests/
ERROR: Could not find a version that satisfies the requirement requests (from versions: none)
ERROR: No matching distribution found for requests
WARNING: There was an error checking the latest version of pip.
I don't think the firewall is blocking it but I am not sure what I need to look for in the firewall - does anyone know the addresses that need to be unblocked?
Or is there another reason for this error?
Thanks!
I tried adding a firewall rule but didn't know what I needed to add.
Try to use another pip index-url
For example:
pip install --upgrade requests -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn

cannot install pandasql in anaconda and having proxy issue

I know this is an old topic but I keep having trouble with installing pandasql in anaconda, I hope someone could help...
what I have tried:
open anaconda prompt, type pip install pandasql, then I got the below error:
"WARNING: Retrying (Retry(total=4, connect = None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError... 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pandasql/"
ERROR: Could not find a version that satisfies the requirement Pandasql (from versions: none)
ERROR: No matching distribution found for Pandasql
I saw some postings saying that it may be proxy issue and I just want to check if my IP is blacklisted by https://pypi.org, then I go curl https://pypi.org
I got the below error:
curl: (28) Failed to connect to pypi.org port 443 after 84242 ms: Timed out
could anyone advise that what else I can do? to install pandasql in anaconda?
Thanks.
Try conda install (package name) instead of pip, since you’re using anaconda already
This page gives you the specific command
https://anaconda.org/anaconda/pandasql

Pip shows web socket error and I cannot install any packages

I tried installing django but didn't work. Instead it gave me this error...
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions')': /simple/django/
ERROR: Could not find a version that satisfies the requirement django (from versions: none)
ERROR: No matching distribution found for django
I tried to install other packages and modules but none of them could be installed. I reinstalled python and while doing that I lose all my previous packages. I had a project with PyQt5 which I could install successfully two weeks ago but after I reinstalled python my packages, modules, etc. where gone and now pip won't work I don't know why.
I tried changing my network and tried using my phone's hotspot but it didnt solve the problem. I tried giving the version name of the packages but that didn't work either.
My network doesn't have a proxy or is not connected to a vpn. I can download any other stuff but I just cannot download stuff with pip.
Thanks in advance!

pip Install throwing No matching distribution found for

I am on my work PC (corporate proxy) and i am unable to install anything using pip install.
I have tried the following:
pip install QuantLib-Python
pip install --proxy 'webproxy.abc.123.nsroot.net:8080' QuantLib-Python
pip install --proxy "user:pass#webproxy.abc.123.nsroot.net:8080" QuantLib-
Python
no matter the library i always receive this message. I am on Python 3.7.3
Collecting QuantLib-Python
Note: you may need to restart the kernel to use updated packages.
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000002BEAFD0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed')': /simple/quantlib-python/
Retrying
No matching distribution found for QuantLib-Python
On my Home PC i ran the command pip install QuantLib-Python with the version of python and it worked perfectly.
please help!

Categories