Having trouble installing protobuf on python mac - python

After running easy_install protobuf I'm getting this:
Using /Library/Python/2.7/site-packages/protobuf-2.5.0-py2.7.egg
Processing dependencies for protobuf
Finished processing dependencies for protobuf
Which (I guess) means that it thinks it's OK but when I try to import google.protobuf I get an error.
Eyals-MacBook-Pro:python2.7 eredler$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import google.protobuf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named google.protobuf
I would appreciate any assistance regarding this.
Thanks

Related

future package not accessible

I am having problems in using future package in h2o:
base) usr#usr-X705UDR:~$ pip install future
Requirement already satisfied: future in /usr/lib/python3/dist-packages (0.18.2)
(base) usr#usr-X705UDR:~$ python
Python 3.8.12 (default, Oct 12 2021, 13:49:34)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import future
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'future'
>>>
How to rectify this?

Error importing cv2 in Python after opencv installation

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

How do I install shogun's python interface?

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.

Python Module not found error even when the module is installed

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

Importing from lxml.etree fails on Python 3.4 running RHEL 2.6.18-371.11.1.el5

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.

Categories

Resources