Python Forum
numpynot associted with correct python version - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: numpynot associted with correct python version (/thread-15274.html)

Pages: 1 2


RE: numpynot associted with correct python version - ErnestTBass - Jan-13-2019

I think that I know why it is not working. I have two versions of Python 3 on my laptop. They are python 3.5.2 and python 3.6.3.

Now in the python 3.5.2 environment i can import ssl no problem.

But in the python 3.6.3 environment I get an error when i import ssl.

The copy and paste shows this below.


python3.6
Python 3.6.3 (default, Jan 6 2019, 04:48:22)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/ssl.py", line 101, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
>>>
james@james-VirtualBox:~$ python3.5
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> import ssl


So how d I fix this? I am not sure, but I believe the above copy and paste shows the isssue clearly.

Any help appreciated. Thanks in advance.

Respectfully,


ErnestTBass


RE: numpynot associted with correct python version - micseydel - Jan-13-2019

(Found as the first Google result for "python importerror _ssl")
Utku Zihnioglu Wrote:Did you build the Python from source? If so, you need the --with-ssl option while building.
(source)
The version of Python with which you're having trouble is the same one you compiled.


RE: numpynot associted with correct python version - ErnestTBass - Jan-13-2019

Yes, I did build from source. Please explain the with ssl option.

Also, how can I fix this? By that I mean if I must reinstall then how do I uninstall
what I already have?

Any help appreciated. Thanks in advance.

Respectfully,

ErnestTBass


RE: numpynot associted with correct python version - ErnestTBass - Jan-14-2019

I am unsure as to how to fix this. I have python version 2.7.15. and 3.5.2 and 3.6.3 on my laptop hard drive.

Only python version 3.6.3 does not have an SSL certificate. Can add one, even after I built python 3.6.3 from source?
Must uninstall python 3.6.3 and then reinstall with -SSL.

I know what the issue is, I just do not know how to fix it.

Any help appreciated. Thanks in advance.

Respectfully,

ErnestTBass


RE: numpynot associted with correct python version - micseydel - Jan-14-2019

You need to rebuild 3.6 from source. While you're at it, you might want to go straight to 3.7 since it's out.


RE: numpynot associted with correct python version - ErnestTBass - Jan-14-2019

Okay, but two things. I guess to rebuild from source means I must first remove python 3.6.2. How do I do that? As I said it was initially built from source.

Second, during the rebuild from source on python 3.6.2 or the build from source of python 3.7, how can I make sure the SSL certificate in installed when the software is built.

In other words when I am doing the ./configure , make and make install where does the with ssl come in?

Any help appreciated. Thanks in advance.

Respectfully,

ErnestTBass


RE: numpynot associted with correct python version - micseydel - Jan-14-2019

Did you install Python 3.6 or just build it? If you just built it, you can just delete it the folder. If you installed it somehow, you'll have to figure out what the reverse of it is (I don't want to speculate without even knowing how you installed it). If it's too much of a pain and you're going to use 3.7 anyway, it might be worth just leaving it.

I'm not sure when the SSL flag gets used, I only know what I linked to. You might be able to figure that out with more Googling, but if it were me I'd just add it to each command and hope for the best - that will probably work and take less time than researching.


RE: numpynot associted with correct python version - ErnestTBass - Jan-16-2019

I was afrid to try your advice, I thought that I would just mess up this Python install further.

However, I did try something. As said, I have Python 3.5.2 and Python 3.6.3 on my computer. I was using as the default,
Python 3.6.2. As You can see in post #11 above it is not working. So I decied to use python 3.5.2 as the default. As you can see in post # 11 it was working. I can import numpy, scipy and so forthe with no problem. or so I thought.

However, when I made python 3.5.2 tyhe deafult, by adding an alias line in my .bashrc, then it stopped working.

I am begining to beleive that it not working not becuase of the ssl certificate being absent it is there, but because it is not connecting to or finding the ssl certificate.

It juat seem determined to not find the ssl certificate when I invoke anything on pthon 3 either 3.5.2 or 3.6.3.

I just do not know what to do now. I think uninstalling python 3.6.3 by the emthod you suggested and installing niot from source, but from from a package is worth a try.

I just do not know what else to do. I have been struggling with this problem since last week-end.

Can you giver me a website where i can idownload and install python (any version higher that 3.5.2) from a package.

I am just out of any other ideas. One other idea is to upgrade pip3 to something higher that 9.0.1. Maybe that will work.

There are so many suggestions of the internet, that I do not know which one to take, the approach I talk about in the sentence immediately above is one on those suggestions. I have tried several thta I found on the internest and none work. - so far.

Any help appreciated. Thanks in advance.

Respectfully,

ErnestTBass