SciPy ImportError on Python 2.6 Anaconda - python

I developed a Python package using Python 2.7 and 3.4, and now I'm trying to test it for 2.6 compatibility. So in Anaconda, I made a new conda environment for Python 2.6:
conda create -n python2.6 python=2.6.9 numpy scipy
But now, when I try to import some stuff from scipy:
$ python
Python 2.6.9 |Continuum Analytics, Inc.| (unknown, Jan 10 2014, 13:33:57)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy.sparse
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jsleinon/anaconda/envs/python2.6/lib/python2.6/site-packages/scipy/sparse/__init__.py", line 212, in <module>
from .csr import *
File "/Users/jsleinon/anaconda/envs/python2.6/lib/python2.6/site-packages/scipy/sparse/csr.py", line 13, in <module>
from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
ImportError: dlopen(/Users/jsleinon/anaconda/envs/python2.6/lib/python2.6/site-packages/scipy/sparse/_sparsetools.so, 2): Symbol not found: __ZNSaIcEC1Ev
Referenced from: /Users/jsleinon/anaconda/envs/python2.6/lib/python2.6/site-packages/scipy/sparse/_sparsetools.so
Expected in: dynamic lookup
Does anybody know a fix or a workaround? I'm using Mac OS X 10.9. The import works fine on 2.7 and 3.4.

Related

Cannot use socket

I am trying to import socket and I get the following error:
$ python
Python 2.7.16 |Anaconda, Inc.| (default, Mar 14 2019, 16:24:02)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "socket.py", line 68, in <module>
from _ssl import \
ImportError: cannot import name RAND_egd
I thought that perhaps my Anaconda installation was corrupted so I uninstalled and reinstalled Anaconda but the error persists.
I had tried what the other posts suggested except for editing socket.py due to Macos System Integrity Protection. My guess is that the problem lies elsewhere as I doubt that everyone has had to edit the file.
How can I find the source of the problem?

import mlpack fails in python

I am trying to use mlpack in python scripts. I just installed the mlpack package from source into my directory /home/glassjawed/local/ and
glassjawed#Y9Acer:~$ ls local/lib | grep mlpack
libmlpack.so
libmlpack.so.3
libmlpack.so.3.0
glassjawed#Y9Acer:~$ ls local/include/mlpack/bindings/python
get_arma_type.hpp print_defn.hpp
get_cython_type.hpp print_doc_functions.hpp
get_numpy_type_char.hpp print_doc_functions_impl.hpp
get_numpy_type.hpp print_doc.hpp
get_param.hpp print_input_processing.hpp
get_printable_param.hpp print_output_processing.hpp
get_python_type.hpp print_pyx.hpp
import_decl.hpp py_option.hpp
mlpack strip_type.hpp
print_class_defn.hpp
So mlpack is clearly installed. HOWEVER, I can't seem to run this in python because I get a module not found error.
glassjawed#Y9Acer:~$ python
Python 3.6.7 | packaged by conda-forge | (default, Nov 21 2018, 03:09:43)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>> import mlpack
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'mlpack'
Why is this happening and how can I fix this? I tried everything.
`

Why do I get a ModuleNotFoundError for winreg on a Linux system?

'winreg' module is not found python 3.6.7. I am not facing this problem in Python 3.4.
Is any third-party app in 'winreg' that I can use same code or how can I solve this.
jaki#jaki-notebook:~$ python3 -V
Python 3.6.7
jaki#jaki-notebook:~$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from winreg import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'winreg'
>>>
ModuleNotFoundError: No module named 'winreg'
It is not work on linux because this package expose functions of the Windows registry API to Python
Read this documentation on python offical website

easysnmp library doesn't work on el-capitan

I'm running OSX ElCapitan and I've brew install easysnmp... nevertheless, when I try to import it on python, I get the following error:
Python 2.7.12 (default, Jun 29 2016, 14:05:02)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from easysnmp import Session
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/easysnmp/__init__.py", line 1, in <module>
from .easy import ( # noqa
File "/usr/local/lib/python2.7/site-packages/easysnmp/easy.py", line 3, in <module>
from .session import Session
File "/usr/local/lib/python2.7/site-packages/easysnmp/session.py", line 8, in <module>
from . import interface
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/easysnmp/interface.so, 2): Symbol not found: _netsnmp_transport_config_compare
Referenced from: /usr/local/lib/python2.7/site-packages/easysnmp/interface.so
Expected in: flat namespace
in /usr/local/lib/python2.7/site-packages/easysnmp/interface.so
easysnmp sites state that it requires net-snmp 5.7 although el capitan is shipped with 5.6... so I've "brew installed" snmp-get 5.7.
Brew doesn't change the symlinks so I'm assuming python is still looking at version 5.6.
Install output :
==> make
==> make install
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X already provides this software and installing another version in
the parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/net-snmp/lib
CPPFLAGS: -I/usr/local/opt/net-snmp/include
==> Summary
🍺 /usr/local/Cellar/net-snmp/5.7.3: 538 files, 12.8M, built in 4 minutes 34 seconds

Cannot import PYMC

When I try to import PYMC installed with pip, enpgk or the canopy GUI package manager, I tried all of them and without success.
Enthought Canopy Python 2.7.9 | 64-bit | (default, Jun 30 2015, 22:40:22)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/renanpc/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/__init__.py", line 30, in <module>
from .CommonDeterministics import *
File "/home/renanpc/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/CommonDeterministics.py", line 21, in <module>
from .utils import safe_len, stukel_logit, stukel_invlogit, logit, invlogit, value, find_element
File "/home/renanpc/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/utils.py", line 14, in <module>
from . import flib
ImportError: libgfortran.so.1: cannot open shared object file: No such file or directory
I tried to install GFORTRAN with :
~$ sudo apt-get install gfortran-4.6
but I still get the same error.
(there are other questions very similar indeed, but usually the answer has to do with Anaconda and I'm using Canopy)
Any idea of what is going on ? I can import other packages.

Categories

Resources