Error with pylibmc on Mac OS Lion - python

I have a problem with pylibmc on Mac OS Lion.
libmemcached — 1.0.4
pylibmc — 1.2.3
$ python
Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylibmc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/pylibmc/__init__.py", line 70, in <module>
import _pylibmc
ImportError: dlopen(/Library/Python/2.7/site-packages/_pylibmc.so, 2): Symbol not found: _memcached_add
Referenced from: /Library/Python/2.7/site-packages/_pylibmc.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/_pylibmc.so
But it works with sudo!
$ sudo python
Password:
Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylibmc
>>>
Any ideas?

Installation in 32-bit mode solved the problem.
You need to install libevent in 32-bit mode
brew install --universal libevent
Next to download libmemcached source (1.0.8 version works for me) and configure force for 32 bit arch:
./configure --build=i386-apple-darwin11.4.2 "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
make
sudo make install
where 11.4.2 is the version of kernel
Reinstall pylibmc
sudo pip uninstall pylibmc
sudo pip install pylibmc
Now it works
$ python -c 'import pylibmc'
$

Looks like a build and/or installation problem with libmemcached. Maybe you can check out issue #101? https://github.com/lericson/pylibmc/issues/101

Related

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.

How do I get Python to see libtorrent-rasterbar in mac os?

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

OSX installing numpy via brew for python3

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.

How to install pync on mac

I want to install pync on mac for showing notification. I tried with
$ pip install pync
git clone git://github.com/SeTeM/pync.git
cd pync
python setup.py install
sudo easy_install pync
Showing error as :
Last login: Thu Nov 21 12:20:51 on ttys000
fiss-Mac:~ fis$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pync import Notifier
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.8-intel/egg/pync/__init__.py", line 3, in <module>
File "build/bdist.macosx-10.8-intel/egg/pync/TerminalNotifier.py", line 99, in <module>
File "build/bdist.macosx-10.8-intel/egg/pync/TerminalNotifier.py", line 27, in __init__
Exception: pync was not properly installed. Head over to https://github.com/SeTeM/pync/ and file a bug.
>>>
You should try pip3 install pync as pip3 works for mac rather than just pip . That is what you should try . If that doesn't work - then you should try to install it from the GitHub link like said in one of the above answers . Hope I was Helpful !! (:
It seems that the package for pync in the Python Package Index does not work properly.
Installing directly from the pync github repo will resolve the issue:
pip install git+https://github.com/SeTeM/pync.git
Just had the same issue.
Unzipping the egg file helped to solve the issue:
cd /Library/Python/2.7/site-packages
sudo unzip pync-1.4-py2.7.egg
sudo rm -r EGG-INFO pync-1.4-py2.7.egg
$ python
Python 2.7.6 (default, Nov 12 2013, 13:26:39)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pync import Notifier
>>>

Python path: why can't pip see latest version of numpy

Working inside a virtualenv, I'm trying to install scikit-image, but it fails, telling me that I need a newer (or any) version of numpy.
$ sudo pip install -U scikit-image
...
ImportError: You need `numpy` version 1.6 or later.
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /Users/aps/Dropbox/experiments/build/scikit-image
I don't understand this, because from Python, numpy 1.7 is already on my path.
$ python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__
'1.7.1'
What is going on - why can't the system installing scikit-image see the newest version of numpy? And how can I fix this?
The path to numpy already seems to be in my ~/.bash_profile:
>>> numpy.__path__
['/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy']
>>> exit()
$ vi ~/.bash_profile
...
export PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages:$PYTHONPATH
UPDATE:
numpy version 1.7 is also in the su path:
$ sudo python
Password:
Python 2.7.5 (default, Aug 1 2013, 00:59:40)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__
'1.7.1'
You need to make sure that all those packages are available within the virtualenv itself. Did you try running pip freeze after sourcing bin/activate? Using the virtualenv package, the only library that comes "preinstalled" by default is distribute, and all other dependencies must be manually added. With venv (built into py3k) all of your system libraries should be available directly. Which are you using?

Categories

Resources