I'm trying to install pyOpenSSL using pip, python version is 2.7, OS is linux.
After pyOpenSSL installed, when I tried to import the module in python, I got the following error:
Python 2.7.5 (default, Jun 27 2013, 03:17:39)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenSSL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 84, in <module>
OP_NO_TICKET = _lib.SSL_OP_NO_TICKET
AttributeError: 'FFILibrary' object has no attribute 'SSL_OP_NO_TICKET'
>>>
I tried to uninstall pyOpenSSL and install it again, but got the same error.
This is because low version pyopenssl has not defined SSL_OP_NO_TICKET。
clone the latest pyopenssl from https://github.com/pyca/pyopenssl.git and install it, then that'll be fine. no thks.
The fix is described here:
https://github.com/pyca/pyopenssl/issues/130
Indeed, you can apply it manually (not really recommended, but easy)
Or download archive from github
The link to the fix: https://github.com/pyca/pyopenssl/commit/e7a6939a22a4290fff7aafe39dd0db85157d5e05
And the fix applied to SSL.py
-OP_NO_TICKET = _lib.SSL_OP_NO_TICKET
+try:
+ OP_NO_TICKET = _lib.SSL_OP_NO_TICKET
+except AttributeError:
+ pass
Related
I am trying to set up an environment using pyenv and homebrew on Ubuntu 20.04. There are no problems with my system install of python. However, when I install a specific version of python using pyenv I run into the following problem upon running Jupyter:
> jupyter notebook
Traceback (most recent call last):
File "/home/parzydlo/.pyenv/versions/3.10.3/bin/jupyter-notebook", line 5, in <module>
from notebook.notebookapp import main
File "/home/parzydlo/.pyenv/versions/3.10.3/lib/python3.10/site-packages/notebook/notebookapp.py", line 76, in <module>
from .base.handlers import Template404, RedirectWithParams
File "/home/parzydlo/.pyenv/versions/3.10.3/lib/python3.10/site-packages/notebook/base/handlers.py", line 35, in <module>
from notebook.utils import is_hidden, url_path_join, url_is_absolute, url_escape, urldecode_unix_socket_path
File "/home/parzydlo/.pyenv/versions/3.10.3/lib/python3.10/site-packages/notebook/utils.py", line 8, in <module>
import ctypes
File "/home/parzydlo/.pyenv/versions/3.10.3/lib/python3.10/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
To verify the package is missing:
> python3
Python 3.10.3 (main, Apr 7 2022, 19:51:28) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/parzydlo/.pyenv/versions/3.10.3/lib/python3.10/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
When I switch back to system python:
> pyenv local system
> python3
Python 3.9.12 (main, Mar 23 2022, 21:36:19)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>>
Following numerous threads here on SO I installed libffi-dev and tried reinstalling pyenv python but the problem persists. Perhaps it is worth mentioning that I'm using homebrew as my package manager, but had to install libffi-dev using apt.
Finally, I read [this post on dev.to][1] which suggested the following fix:
CC="$(brew --prefix gcc)/bin/gcc-11" \
pyenv install --verbose 3.10.0
Unfortunately, this too did not resolve the issue.
[1]: https://dev.to/ajkerrigan/homebrew-pyenv-ctypes-oh-my-3d9#isolating-the-useful-change
I have similar issue, the trick is you need to reinstall the same python version, e.g pyenv install -f after all apt install lib**-dev.
I have multiple pythons installed in my machine, 2.7, 3.5, 3.6, etc and I installed the library called spacy.
And it seems like this library keeps referring to the old version of python which is 3.5. at /usr/local/lib/python3.5/dist-packages.
Python 3.6.5 (default, Mar 29 2018, 03:28:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import spacy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/spacy/__init__.py", line 4, in <module>
from . import util
File "/usr/local/lib/python3.5/dist-packages/spacy/util.py", line 4, in <module>
import ujson
ModuleNotFoundError: No module named 'ujson'
Regardless of this specific library 'spacy', I'd like to know
what is the best way to make library to point to upgraded python which is 3.6, not 3.5. Which path variable should I update?
Please help... I've been wasting too much time on this issue.
Try to install spacy lib by running pip with required python version in module mode:
python3.6 -m pip install spacy
When I run import theano in Python, I get the following error message:
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import theano
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 74, in <module>
from theano.printing import pprint, pp
File "/usr/local/lib/python2.7/dist-packages/theano/printing.py", line 35, in <module>
if pd.find_graphviz():
AttributeError: 'module' object has no attribute 'find_graphviz'
What could be the issue, and how to fix it?
I use Theano 0.8.2 on Ubuntu 14.04.4 LTS x64 with Python 2.7.6 x64.
I unsuccessfully tried:
sudo apt-get install -y graphviz libgraphviz-dev
In pydot 1.2.x version,find_graphviz function have been deprecated. To fix this issue, you should install pydot 1.1.0 version here https://github.com/erocarrera/pydot/tree/v1.1.0 . And it is work for me. May help.
I solved by installing pydot-ng --> $ pip install pydot-ng
For some reason, the Python module pydot was creating the issue:
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import pydot
>>> pydot.find_graphviz()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'find_graphviz'
I was using pydot 1.2.2.
I uninstalled it using sudo pip uninstall -y pydot, and I then was able to successfully import theano.
Bug report: https://github.com/Theano/Theano/issues/4759
I solved it by using
sudo pip install graphviz
sudo apt-get install graphviz
with the pydot version 1.2.3 works fine
I have installed zmq and pyzmq.But I can't import pyzmq.
>>> Successfully installed pyzmq
Cleaning up...
hepeng#hp:~$ python
enter code here
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyzmq
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pyzmq
But I can import zmq.
>>> import zmq
>>>
So why?Thanks.
pyzmq is the PyPI package installer name, but the actual root package is named and imported as zmq. This is just how some Python packages work; PyYAML is another example, being installed under the name PyYAML, but imported as yaml.
If you take a look at the zmq docs or pyzmq API, you'll notice all the Python examples import as zmq.
I installed the latest version of lxml.etree compatible with Python 3.4. However when I try importing the package, I hit the following error:
> python
Python 3.4.1 (default, Nov 12 2014, 13:34:29)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /users/vinapai/nxapi/pyats/lib/python3.4/site-packages/lxml/etree.cpython-34m.so: undefined symbol: xmlMemDisplayLast
>>>
I tried using both pip install and easy_install and tried different packages of lxml but consistently hit this error. Any help would be greatly appreciated.