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
Related
I am attempting to install a local directory as a python package, so as to make other modules in the package accessible to each other, similarly to how java files are able to access each other.
python -m pip list | grep sumobot returns:
sumobot 0.1 /home/pi/Documents/sumobot
However, trying to run a file in the package returns this error:
Traceback (most recent call last):
File "tests/test_motor.py", line 1, in <module>
from sumobot.robot_hardware.motor import RawMotor as Motor
ModuleNotFoundError: No module named 'sumobot'
I'd like to understand how this can be the case, as from my reading, installing with python -m pip should fix issues of wrong python versions. Also, if there is a better way to do what I am looking to do, please let me know.
If it makes a difference, I am running this on a raspberry pi zero, and the contents of my setup.py (which was placed in the same directory as my sumobot package) are as follows:
from distutils.core import setup
setup(name='sumobot',
version='0.1',
description='is a sumobot!',
packages=['sumobot'])```
I am working on a Back Up system named RunUp - Is still on a very early stage.
You can see all the source code on its GitHub page. And also, I uploaded it to PyPI, so, probably you won't have any problem to see what is happening by your self.
Well, this is the thing:
If you download the repo, move to the root, create your virtual environment and run pip install --editable . (do not omit the dot), you will see that the installation runs well and if you use runup --version it will show the output RunUp, version 0.1.dev4. Everything is OK.
But...
If you open a new console (or uninstall the package) and download it directly from PyPI with pip install runup, it will be installed without problem but when you use it (running again runup --version) it will output an error message:
Traceback (most recent call last):
File "/home/user/path/to/repo/venv/bin/runup", line 5, in <module>
from src.runup.cli import cli
ModuleNotFoundError: No module named 'src'
I don't know very well why this is happening but I may think that is related to my setuptools implementation or the directory tree. Not really sure about that.
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.
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.
I installed the package python-gconf on Ubuntu 12.04 and played with it: it's a python binding to the gnome configuration tool, and there is no pypi package for it.
As soon as I created a virtualenv (without --no-site-packages), any attempt to import gconf would lead to ImportError.
The gconf module works fine at the system level, but not in the virtual env. I investigated, and opening python-gconf.deb teached me that it's just a gconf.so binary.
Searching for it tells me it's been installed in /home/lib/python2.7/dist-packages/gtk-2.0/gconf.so
I did try to force Python hands:
sudo ln -s /usr/lib/python2.7/dist-packages/gtk-2.0/gconf.so ~/.virtualenvs/appetizer/lib/python2.7/site-packages/
But it only resulted in:
>>> import gconf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: could not import gobject (error was: 'No module named gobject')
So I'm guessing it's very dependant to GTK.
You should create your virtualenv using --system-site-packages option to make all system packages visible. Symlinking external packages into virtualenv's structure also works for most situations when you need only one external package.
If you have already created your virtual environment, just remove the no-global-site-packages.txt file from it to make it see system packages.