I'm trying to dockerize a python script where it contains a python request for handling the API.
But when I tried to run docker it raises the below error
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='reqres.in', port=443): Max retries exceeded with url: /api/users (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9c08686910>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
For reference code:
FROM python:3
ADD ./HMS.py /
ADD ./constants.py /
ADD ./Docker.py /
ADD ./HNT.py /
ADD ./Utility.py /
RUN pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org docker
RUN pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org grepfunc
RUN pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org requests
CMD [ "python", "./HMS.py" ]
May I know what is missing in my code to rectify the aforementioned error.
It tries to build docker image using ->docker build -t ont_alarm_docker .
And inorder to run -> docker run ont_alarm_docker
Hope someone could help as this may be common issue,
UPDATE
After starting nginix image I was able to get the response. May I know how can I add NGINIX in the above docker file.
Another issue is am not able to write some file when I dockerize the container.May I know the solution for that too
Related
I have set up a new environment on conda.
Once it was created, I disabled threading so that the performance of the software I would be using will be maximised using:
conda env config vars set OMP_NUM_THREADS=1
conda env config vars set NUMEXPR_MAX_THREADS=1
I then tried to install the software and got the error
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
Exception: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /conda-forge/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
I though this could be specific to the software.
To test this, I tried installing python with
conda install -c conda-forge python
I got the same error here
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
Exception: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /conda-forge/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
It seems to be an issue with the environment, but I have set up other environments on this machine before and never had this issue.
Does anyone know what could be causing this issue?
I have now resolved this!
If anyone else has the same issue, going back into the base environment and then using "conda install -n name_of_environment python" worked.
I am trying to install Dtale in jupyter notebook. Due to the firewall restrictions, I cannot install it online. I tried to download the archive file dtale-2.2.0.tar.gz and ran this command inside the jupyter notes.
pip install <path>/dtale-2.2.0.tar.gz
This fails as it could not find pypandoc. Then I downloaded the pypandoc-1.7.5.tar.gz and ran
pip install <path>/pypandoc-1.7.5.tar.gz.
But this time I get the error:
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/d2/04/08841501db81bceb7a86a98dea7c12b0185fcc69bfdf1aea266f727d1d7e/poetry_core-1.0.8-py2.py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)')))
I know the host is unreachable due to the firewall, that is the reason why I downloaded the package. Can someone guide me through how to install the packages from the .gz archive file?
Thanks
this error tells you that there is a pkg in dependencies that can NOT be downloaded.
its name is poetry-core, so you should download and install it manually.
here is a url for it: https://files.pythonhosted.org/packages/d2/04/08841501db81bceb7a86a98dea7c12b0185fcc69bfdf1aea266f727d1d7e/poetry_core-1.0.8-py2.py3-none-any.whl
in case you can't download it too due to your firewall, you can use VPN.
in case you can't do that either, then you can download it from this url:
https://www.mediafire.com/file/kpnfupmf5px84um/poetry_core-1.0.8-py2.py3-none-any.whl/file
I have downloaded and re-uploaded it
I am trying to use Python wheels. When I do pip install wheel, it says that the requirement is there, however I get this SSL error:
(base) C:\Users\xxxx\PycharmProjects\prepay_clone>pip install wheel
Requirement already satisfied: wheel in c:\programdata\anaconda3\lib\site-packages (0.33.1)
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))) - skipping
At first I ignored it, since the wheel seems installed. However, when I later run setup.py sdist bdist_wheel, it doesn't output absolutely anything.
Thanks in advance!
To answer your question, the --trusted-host flag tells pip not to bother with SSL for the specified host. I have this problem all the time on a corporate network. I've found this to work 99% of the time:
pip --trusted-host pypi.org --trusted-host files.pythonhosted.org install wheel
I'm not sure if this is your problem though, pip seems to be telling you that wheel is already installed.
I was trying to install Tensorflow by creating an environment but I got an error because I my Self-Signed Certificate. I fixed this once with pip but I don't know how to do that with Anaconda.
The error is:
Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'tls_process_server_certificate\', \'certificate verify failed\')])")))'))
I tried to find a command to fix that but could not find one. I am supposed to be able to create the environment without any issue.
I have searched on Internet and found something related to Conda issue.
Before going to 1) and 2) steps, just type
conda config --set ssl_verify no
Then do following:
Create new environment by typing(optional)
conda create -n tensorflow pip python=3.7
activate tensorflow
Install Tensorflow 1.9
pip install --ignore-installed --upgrade tensorflow==1.9
I didn't get any error with this. If you have errors, comment down below.
My institution runs a filter that makes less safe sites inaccessible. One site that I can reach just fine using a browser is
https://pypi.python.org/simple/waitress/
and yet if I run pip -vvv install waitress (the problem occurs with all packages, not just waitress) from an Anaconda command prompt I get:
Could not fetch URL https://pypi.python.org/simple/waitress/:
connection error: HTTPSConnectionPool(host='pypi.python.org', port=443):
Max retries exceeded with url: /simple/waitress/ (Caused by
NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection
object at 0x00000000050FD400>:
Failed to establish a new connection: [WinError 10061]
No connection could be made because the target machine
actively refused it',)) - skipping
I can request to selectively open the necessary URLs, but in this case it appears that port 443 at pypi.python.org is already open.
Can you explain this puzzle? Why is pip unable to reach a site that a browser (on the same machine) can reach?
This a simple solution using ssl, since the release of pip 10.0, you should be able to fix this permanently just by upgrading pip itself:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pip waitress
Let me know if works