I'm on a Mac. Step 1:
sudo conda install -c conda-forge shogun
Step 2:
$ python
Python 2.7.12 |Anaconda custom (x86_64)| (default, Jul 2 2016, 17:43:17)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import shogun
>>> from shogun import RealFeatures, PolyKernel, CSVFile
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name RealFeatures
I also tried on Fedora using the RPMs. After verifying that the C++ interface works (gcc shogun.cpp -I/usr/include/shogun/base -lshogun -L/usr/lib64/libshogun.*) I followed the instructions here and set PYTHONPATH=/usr/lib64/python2.7/site-packages/modshogun.py
And then:
$ python
Python 2.7.13 (default, May 10 2017, 20:04:36)
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import shogun
>>> from shogun import RealFeatures, PolyKernel, CSVFile
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name RealFeatures
The problem here is probably that shogun's docs are currently for the in-development version 6.1, but the conda package is for the latest actual release 6.0. In 6.0, you need to do from modshogun import RealFeatures; the shogun package is the old interface, and the modern "modular" one is modshogun. This will be renamed to just shogun in the upcoming 6.1 release.
Related
I've successfully installed OpenCV, but when I try to import it in Python, I get the errors below.
In Python 2.7, I'm getting this
[imukunya#li165-244 site-packages]$ python
Python 2.7.5 (default, Oct 30 2018, 23:45:53)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import
In Python 3.6, I'm getting this error
[imukunya#li165-244 site-packages]$ python3.6
Python 3.6.5 (default, Apr 10 2018, 17:08:37)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define module export function (PyInit_cv2)
I've already tried installing NumPy using $~python3 -m pip install numpy -I
Please try to execute the below command. Then please verify whether your code is working.
python -m pip install opencv-contrib-python
I try to install libtorrent-rasterbar, but Python does not see the module. The El Captaine system. Tell me where to look?
andrew: ~ $ brew install python3
Warning: python3-3.6.0_1 already installed
andrew: ~ $ brew install libtorrent-rasterbar
Warning: libtorrent-rasterbar-1.1.1 already installed
andrew: ~ $ python
Python 3.6.0 (default, Mar 4 2017, 12:32:37)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtorrent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'libtorrent'
>>>
For python2 it work: https://gist.github.com/jacobzelek/ecb6e98feb91d911e231
May be for python3 is similarly
When I try to import the Image module, it fails to find the module.
nn-MacBook-Pro-3:~ nn$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Image
>>>
Pip list shows that it is installed.
nn-MacBook-Pro-3:~ nn$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
appnope (0.1.0)
bleach (1.5.0)
cycler (0.9.0)
dask (0.13.0)
decorator (4.0.11)
distribute (0.7.3)
Django (1.10.5)
email (6.0.0a1)
entrypoints (0.2.2)
Flask (0.10.1)
html5lib (0.9999999)
image (1.5.5)
I'm using Mac's default python version.
nn-MacBook-Pro-3:~ nn$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
The PYTHONPATH variable seems to be empty, but when I try to import other already installed packages it does not show the "no module found" error.
nn-MacBook-Pro-3:~ nn$ echo $PYTHONPATH
I have also tried everything stated here, but it didn't work for me.
Update
As Suggested that modules are case sensitive, I tried the following, it but didn't work either.
nn-MacBook-Pro-3:~ nn$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named image
you need to do import image instead of import Image
module names are case-sensitive
I can't install numpy for python3 via brew.
I type:
brew install numpy --with-python3
then it's OK for python2
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>
but still not found for python3
Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
>>>
How to make it work for python3 ?
The correct way to install it is via:
pip3 install numpy
Obviously, you need to install python3 and pip first. I tested and works without any problem.
The problem with the Homebrew is that it sees only the system's python and the one it installed itself. So you have to first install python3 via brew and then use the --with-python3 option.
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.