Not well experienced with doing installs. I finally got scikits.audiolab-0.11.0 installed, I think. Now the module cannot be found.
from audiolab import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named audiolab
Does this need that I need to add it to my PATH or something? And how should I do that?
Below are 1. the last few lines of messages I got from the scikits.audiolab-0.11.0 install, and then below that 2. the results from echo $PATH on my machine.
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.6-intel.egg
Processing dependencies for scikits.audiolab==0.11.0
Searching for numpy==1.6.1
Best match: numpy 1.6.1
Adding numpy 1.6.1 to easy-install.pth file
Using /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Finished processing dependencies for scikits.audiolab==0.11.0
echo $PATH
Macintosh:~ wolf$ echo $PATH
/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
You should make sure that wherever the audiolab package is stored, that that filepath is on your PYTHONPATH.
PATH is used to launch programs, PYTHONPATH is where Python looks for modules.
Related
I was having problems with a 'zlib' import error on Python3.4.1, so I followed the instructions here, but instead of doing it for Python 2.6 I did it for 3.4. I had not uninstalled my existing version of Python3.4 before doing this new installation process. I can now import zlib, however all of my custom packages cannot be imported, such as sklearn, scipy, numpy, flask, and pandas.
First, I get an import error:
>>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'scipy'
So, I try to remedy the issue with:
pip3 install scipy
But, I am greeted with:
Requirement already satisfied: scipy in /usr/local/lib/python3.4/dist-
packages
Requirement already satisfied: numpy>=1.8.2 in
/usr/local/lib/python3.4/dist-packages (from scipy)
I tried running echo $PYTHONPATH but it returned blank.
I can import sys, os, time, and zlib just fine. It just won't import all of the dependencies that I already have on my computer.
I tried deleting the folder in /tmp where I installed the "newer" Python3.4.1 folder, however this did not work. I don't know how to fix this issue.
I can still run python scripts in an anaconda virtual environment that I had created a while ago, but I can't use virtualenv's, which is a problem since I use zappa a lot (which requires an active virtualenv).
This is what I get when I try to run a virtualenv:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007fb1bc7f4740 (most recent call first):
Aborted (core dumped)
The python version that contains all of my dependencies in dist-packages is located in /usr/local/bin/python3.4. How can I make it so that when I run python3 that it will use the dependencies from that folder? Is the fact that the pythonpath variable is blank bad?
I just want my old python back.
PS. Everything works fine for python2. It's just causing these issues for python3.
I had a similar issue, but with another package. In my case it turned out that I had a egg-info file present in the site-packages without the directory for the package. Deleting the egg-info file (actually I moved it first) allowed a clean install to occur.
This is the error I get when trying to import numpy on opening python (2.7.8):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
This is the path of my python binary /usr/local/bin/python
This is the path of pip /usr/local/bin/pip
Also, when I put in pip freeze I found the numpy package numpy==1.8.0rc1
I have looked at other relevant questions, but I'm not able to diagnose the cause. I'm guessing it might be some problem in PATHS. Where do I start?
As Akshat pointed out in the comments above, I had multiple versions of Python installed. This could have been the effect of using homebrew and/or macports in the past. I followed the steps detailed in Too many pythons on my Mac OS X Mountain Lion
and did a fresh install of Python 2.7.12 I was then able to reinstall pip and the packages subsequently.
Could someone please advise in resolving the below error?
Python 3.5.1 / jpype1-py3 0.5.5.2 installed on 64 bit windows machine.
I've cannot find _jtype anywhere in Lib or Lib/site-packages.
Regards
Steve
>>> import jpype
Traceback (most recent call last):
File "", line 1, in
import jpype
File "C:\Program Files\Python35\lib\site-packages\jpype\__init__.py", line 18, in
from ._jpackage import *
File "C:\Program Files\Python35\lib\site-packages\jpype\_jpackage.py", line 18, in
import _jpype
ImportError: DLL load failed: The specified module could not be found.
According to this thread, you need to make sure setup.py is pointing to the correct jvm directory. looking into setup.py of you can see that it searches for JAVA_HOME system variable:
java_home = os.getenv('JAVA_HOME', '')
found_jni = False
if os.path.exists(java_home):
platform_specific['include_dirs'] += [os.path.join(java_home, 'include')]
# The code goes on
It may be that you didn't configure this system variable.
Since you installed via pip, and probalby didn't touch te setup.py file, I recommend you to do the following:
1-) Uninstall the package, and delete the build directories
2-) Set JAVA_HOME variable following this
3-) Download JPype manually from github and install it using python setup.py install
Good luck, tell me if it works
I'm trying to convert a yoda file produced by a Rivet analysis into a Root file. When I try to do this, I get the error:
yoda2root Rivet.yoda test.root
Traceback (most recent call last):
File "/usr/local/bin/yoda2root", line 24, in module
import ROOT
ImportError: No module named ROOT
I installed everything using Homebrew, except Yoda as the version in homebrew was older and was incompatible.
When looking at similar problems that people have had, often the answer was to set the $PYTHONPATH, but I have tried this and it has had no affect - though I could be setting it incorrectly.
I also cannot find PyROOT anywhere (Perhaps this is the problem?), should this have been installed with Homebrew?
Thanks!
You need to setup your environment variables so that python sees ROOT bindings:
pushd $(brew --prefix root) >/dev/null; . libexec/thisroot.sh; popd >/dev/null
Here is a post about installing a module in python3. When I use brew install python, then it installs it for 2.7.
When I use the method suggested by dan, which aimed to install it directly in python3 (who i really thank), but which didn't work :
# Figure out the path to python3
PY3DIR=`dirname $(which python3)`
# And /then/ install with brew. That will have it use python3 to get its path
PATH=$PY3DIR:$PATH brew install mapnik
The installation was successful but in python2. so I get:
For non-homebrew Python, you need to amend your PYTHONPATH like so: export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
so i finally add the path manually in python3 :
import sys
sys.path.append('/usr/local/lib/python2.7/site-packages')
I get this error :
Traceback (most recent call last): File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/mapnik/__init__.py", line 69, in <module>
from _mapnik import * ImportError: dlopen(./_mapnik.so, 2): Symbol not found: _PyClass_Type Referenced from: ./_mapnik.so
Expected in: flat namespace in ./_mapnik.so
Please help, I have spent so many hours on this ...
Thanks!!!
The Mapnik python bindings depend on boost_python. And both need to use the same python. The problem is likely that homebrew is providing a bottle of boost which includes boost python built against python 2.7 and not python 3.x.