Any way to import python libraries without pip install? - python-3.x

Due to employer's restrictions I couldn't use pip install nor the automatic installment in PyCharm on my office laptop. Both of this ways return error like:
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')
Before few months I found a workaround - just to disable the VPN during the library's installation and that worked for a while, but after some time they pushed an Windows update which forbid this method too.
If I have Pandas library successfully installed on my laptop, is there any way how to export it to another machine (under the same installation restrictions)?

Related

How can I run anaconda and VS Code together with single Python version

Following is the error message I am getting when running conda install pandas:
Collecting package metadata (current_repodata.json): failed
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
Exception: HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
Till yesterday, everything was fine. Than I had to install MU Editor and since than this problem occurred. I have no clue how to resolve it.
Can you please help.
I know uninstalling MU Editor and maybe reinstalling andaconda3 will resolve the issue. But that will not solve my problem. I need MU Editor too. I am using andaconda for pandas and for python I was using VS Code but the day I installed Anaconda3, that stopped working. So I had installed MU Editor.

Pip cannot install - error "Temporary failure in name resolution" on Debian WSL

This is my first stackoverflow question!
Recently python pip install has stopped working and is giving the following error:
pip3 install django
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f07a41b75c0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/django/
The error repeats several times until it gives up.
I'm using Python3 in Linux Debian on WSL (Windows Subsystem for Linux), on Windows 10.
After some searching and seeing some suggestions I found that my /etc/resolv.conf contains only:
^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#^#
This doesn't look quite right... could this be the problem?
What is resolv.conf supposed to contain?
Thinking about what could be the root cause... before this happened the computer was accidentally switched off at the mains whilst apache2 and mysql services were running (in debian on WSL), could this have caused the problem?
Thanks in advance, Mark
/etc/resolv.conf (manpage) usually only has a few, often automatically generated, lines that are pulled in from its network's configured DNS configuration.
In my WSL OpenSUSE, the entire resolv.conf file is:
# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.
nameserver 1.1.1.1
Which it pulls from the configuration in my home router.
I am not sure why your resolv.conf would be any different from that, unless it is something weird with the newer WSL2 that I have yet to try.
You can try manually configuring a nameserver or two with a public DNS like 1.1.1.1 or 8.8.8.8. Though that may not keep it from being overwritten until you figure out if there is an underlying problem.
On an installed Linux system instead of a WSL, that uses NetworkManager, it would be prefixed with # Generated by NetworkManager instead of the above WSL note.

Insecureplatform warning

I am trying to install pytorch on ubuntu 14.04, and i am using python 2.7.6/ cuda 8.0. But error comes out.
error 1:
torch-1.0.0-cp27-cp27m-linux_x86_64.whl is not a supported wheel on this platform.
error 2:
InsecurePlatformWarning
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure'),)': /whl/cu80/torch-1.0.0-cp27-cp27mu-linux_x86_64.whl
/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:150: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='download.pytorch.org', port=443): Max retries exceeded with url: /whl/cu80/torch-1.0.0-cp27-cp27mu-linux_x86_64.whl (Caused by SSLError(SSLError(1, '_ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure'),))
I found that Insecureplatformwarning always appeared whenever i tried to install new modules. Is it possible to solve this problem without changing version of python or cuda? Since i am using tensorflow1.3.0 for python 2.7 and cuda 8.0, I am reluctant to change the version of python or cuda.
The first issue of the unsupported pytorch wheel is addressed in detail in the related posting specific to your case. Please try torch-1.0.1.post2-cp27-cp27mu-manylinux1_x86_64.whl (582.5 MB) downloadable via web browser from the Python Package Index website.
About the SSLError...sslv3 alert handshake failure, the error suggests that your operating system's OpenSSL library version<1.0.1 and Python version<2.7.9 do not support the newer TLS protocol version 1.2 that pip requires to connect to PyPI since about a year ago.
You can check the system OpenSSL library version with:
$ python -c "import ssl; print(ssl.OPENSSL_VERSION)" && openssl version
Even if the openssl library was up-to-date, another problem is that Python version 2.7.6 itself has ssl module that doesn't support PROTOCOL_TLSv1_2, which needs Python versions 2.7.9+ (or 3.4+) or later. In Ubuntu, the Python 2.7.9 version first appeared in Vivid Vervet (15.04) and Python 3.4 - since 14.10 (Utopic Unicorn), while current 18.04 LTS (Bionic Beaver) ships 2.7.14+ and 3.6.4+ respectively.
" > Is it possible to solve this problem without changing version of python or cuda? "
Fortunately, yes, to fix it you can install several Python wheels (packages) manually -- the detailed step-by-step guide is available here on Stackoverflow.
Specifically, the cryptography manylinux1 wheel contains the most recent statically-linked OpenSSL library that will re-enable pip (versions 10+) and will allow you to continue to use your good old Ubuntu linux with new Python programs.

PyCharm will not perform a requests module update to the newest version

I am having difficulty running a piece of requests code in my IDE PyCharm. The code is very basic and will work on my system for every website except one. Here is the code I am running:
import requests
initialURL = 'http://www.acastipharma.com/'
r = requests.get(initialURL)
When I run this code I get an error message that terminates with
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.acastipharma.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:645)'),))
I first thought this was an SSL problem, but if I run the requests command with the verify=False switch I still get the same error. This leads me to believe that the problem is not an SSL problem. I tried running the same code from a different IDE and the error did not occur which led me to believe the problem lies with my IDE PyCharm. I tried using a different project interpreter in PyCharm and the error also did not occur. I realized that the two different PyCharm project interpreters used different versions of requests and every PyCharm project interpreter I use that has the most recent version of requests the code will work but if the PyCharm project interpreter uses an older version of requests the error appears. Unfortunately PyCharm for some reason will not allow me to update the requests module in the PyCharm project interpreter I am using. Here is the error message I get from PyCharm when I attempt to update requests:
Could not find a version that satisfies the requirement requests==2.19.1 (from versions: )
No matching distribution found for requests==2.19.1
PyCharm then suggests that I run the upgrade command from terminal:
pip install -U requests==2.19.1
Here is what PyCharm suggests:
Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5'.
When I run this from terminal I get this:
Requirement already up-to-date: requests==2.19.1 in ./anaconda/lib/python3.5/site-packages (2.19.1)
It seems likely that the upgrade from terminal is occurring to the wrong directory, it is trying to update
./anaconda/lib/python3.5/site-packages
when I need it to update
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
Does anybody know how to specify the correct directory for the update when I run the pip install -U requests==2.19.1 command at terminal. Any assistance on how to get requests properly upgraded, whether from within PyCharm or at terminal, would be appreciated.
It turns out the problem was two-fold. The first problem was the version of OpenSSL that the project interpreter I was using was deprecated. I also had two versions of Python 3.5 on my system and whenever I would attempt to update a package (ie. OpenSSL) the version of python that was not used by my project interpreter would update rather than the version of Python 3.5 I was using for the project interpreter. I ended up installing Python 3.7 and creating a project interpreter based on Python 3.7. By having only one version of 3.7 on my system I was able to update the OpenSSL package specifically associated with 3.7 and the problem went away.

Unacceptable TLS certificate- When trying to install the MonoDevelop Flat Pak

After installing FlatPak and following the instructions to install MonoDevelop here
The Command I run is: sudo flatpak install --user --from https://download.mono-project.com/repo/monodevelop.flatpakref
But the error I receive is:
Can't load uri
https://download.mono-project.com/repo/monodevelop.flatpakref:
Unacceptable TLS certificate
Is this a problem with thier site that they need to fix? or is there something I can do on my machine.
My OS is Peppermint 7 based on Ubuntu 16.04
The certificate is for *.vo.msecnd.net
The domain the certificate is delivered on is
download.mono-project.com
They bound the wrong certificate to the wrong domain.
You can't fix this, only send a bug report/issue ticket to their website maintainers.
This may be not as secure as using the https option, but this is what I did to solve the problem. I downloaded the file monodevelop.flatpakref, and using a text editor I opened it and edited the Url line from https://... to http://...
That did the magic. To install I used the command sudo flatpak install --user monodevelop.flatpakref in the location where I saved the file.

Resources