Python Forum
numpynot associted with correct python version
Thread Rating:
  • 4 Vote(s) - 3.25 Average
  • 1
  • 2
  • 3
  • 4
  • 5
numpynot associted with correct python version
#11
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
Reply
#12
(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.
Reply
#13
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
Reply
#14
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
Reply
#15
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.
Reply
#16
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
Reply
#17
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.
Reply
#18
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Selecting correct xlrd version Kithsiri 4 448 Feb-27-2024, 07:09 AM
Last Post: Kithsiri
  run part of a script with a different version of Python jdog 2 395 Jan-09-2024, 08:49 PM
Last Post: jdog
  How to find out from outside Python (in Windows) the current version of Python? pstein 4 680 Oct-04-2023, 10:01 AM
Last Post: snippsat
  How to resolve version conflicts in Python? taeefnajib 0 873 Apr-27-2023, 08:37 PM
Last Post: taeefnajib
  Python venv and PIP version issue JanOlvegg 2 1,200 Feb-22-2023, 02:22 AM
Last Post: JanOlvegg
  Python Version upgrade nitinkukreja 1 855 Feb-04-2023, 10:27 PM
Last Post: Larz60+
  Can't update new python version on Pycharm GOKUUUU 6 3,712 Jul-23-2022, 09:24 PM
Last Post: GOKUUUU
  Building python (3.9.5) with different libexpat version (2.4.6) raghupcr 0 1,262 Feb-25-2022, 11:29 AM
Last Post: raghupcr
  Python keeps running the old version of the code quest 2 3,646 Jan-20-2022, 07:34 AM
Last Post: ThiefOfTime
  db migration(db version control) for python lubaz 2 2,701 May-30-2021, 01:36 PM
Last Post: lubaz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020