Error installing rootpy: ROOT cannot be imported. Is ROOT installed with PyROOT enabled? - pyroot

I am a 10.13.4 Mac user and I have ROOT 6.14.00 installed from running the dmg file downloaded from https://root.cern.ch/content/release-61400. I then tried to install rootpy by
sudo pip install rootpy
it gives me the error
ROOT cannot be imported. Is ROOT installed with PyROOT enabled?
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-Idx6tf/rootpy/
I do not know what is going on, but I see the root_v6.14.00 lying in Application/ folder (and I see documentation says that pyROOT is on by default), and I have python 2.7.10 installed on my Mac. There seem to be no documentation online for solving this issue. I wonder if anyone knows what is going on or am I better off install rootpy on ubuntu on a virtual machine?

The problem is that you might have a local installation of ROOT. If you don't want to install ROOT system wide, you can install rootpy for your user only:
python setup.py install --user
If this is not what you want, you can login as root using sudo su, then export what is in thisroot.sh from wherever your ROOT installation is:
source path_to_root/bin/thisroot.sh
Then you can install rootpy system-wide executing python setup.py install, without logging out as root.

Related

UWSGI error with PCRE Ubuntu 20.04 error while loading shared libraries: libpcre.so.1:

I run through the following steps to attempt to start up an app for production:
-Setup a virtualenv for the python dependencies: virtualenv -p /usr/bin/python3.8 ~/app_env
-Install pip dependencies: . ~/app_env/bin/activate && pip install -r ~/app/requirements.txt
-Un-comment the lines for privilege dropping in uwsgi.ini and change the uid and gid to your account name
-Login to root with sudo -s and re-source the env with source /home/usr/app_env/bin/activate
-Set the courthouse to production mode by setting the environment variable with export PRODUCTION=1
-Start the app: cd /home/usr/app && ./start_script.sh
And I get the following error:
(app_env) root#usr-Spin-SP314-53N:/home/usr/Desktop/app# ./start.sh
uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
I tried a few things such as installing a newer libpcre version like mentioned here, tried also the steps mentioned here but that didn't work. Also the environment I'm setting up doesn't use anaconda but regular python. I even tried pip install uwsgi in my virtual env but it said the requirement was already satisfied. I'm not much of an expert when it comes to somewhat complex package management like this, help with how to solve this would be greatly appreciated. Thanks. I'm on Ubuntu 20.04, using python 3.8.
What solved it for me was apparently just reinstalling UWSGI, like in this thread, in my virtual env while forcing it to ignore the cache so it could know to use the pcre library I installed.
In order, doing this
uwsgi --version
Was giving me this
uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
So I made sure I had the latest libpcre installed
sudo apt-get install libpcre3-dev
And then what linked it all together was this
pip install uwsgi -I --no-cache-dir
I tried to solve this error but it did not work no matter what I did and then reinstalled uwsgi, but the following 2 lines solved my problem
sudo find / -name libpcre.so.*
#change the path of the /home/anaconda3/lib/libpcre.so.1 with the one appears after above one.
sudo ln -s /home/anaconda3/lib/libpcre.so.1 /lib
which python

why (miniconda) pip install in .local

pip install is installing packages in my user's .local directory, a behaviour that I would like to avoid. Here is my setup:
(base) MYUSER#MYMACHINE:~$ which pip
/home/MYUSER/miniconda3/bin/pip
(base) MYUSER#MYMACHINE:~$ which python
/home/MYUSER/miniconda3/bin/python
An example trying to install bottleneck:
(base) MYUSER#MYMACHINE:~$ pip install bottleneck -v
...
Installing collected packages: numpy, bottleneck
changing mode of /home/MYUSER/.local/bin/f2py to 775
changing mode of /home/MYUSER/.local/bin/f2py3 to 775
changing mode of /home/MYUSER/.local/bin/f2py3.6 to 775
Successfully installed bottleneck-1.3.2 numpy-1.19.0
Cleaning up...
Although I expect bottlneck to be installed in /home/MYUSER/miniconda3/lib/python3.7/site-packages, it actually gets installed in .local instead:
(base) MYUSER#MYMACHINE:~$ ls ~/.local/lib/python3.6/site-packages/bottleneck/
benchmark nonreduce_axis.cpython-36m-x86_64-linux-gnu.so _pytesttester.py src
__init__.py nonreduce.cpython-36m-x86_64-linux-gnu.so reduce.cpython-36m-x86_64-linux-gnu.so tests
move.cpython-36m-x86_64-linux-gnu.so __pycache__ slow _version.py
I hope I have provided enough information to debug this.
A crucial piece of information that I thought was irrelevant is that I am executing these commands in a VNC session. It was brought to my attention that the environment variables when a new terminal is launched within the VNC session are inherited from the terminal that created the VNC session.
For more information:
https://unix.stackexchange.com/questions/400329/gnome-terminal-inherits-some-environment-even-with-env-i-on-a-vnc-session
In my case, the environment variables (i.e. PATH, PYTHONPATH) were messed up due to the above reason. Solved now

installed python 3x on mac but terminal still show version still 2x

I installed python 3x via home brew, the process was successful.
However when I check version, it shows 2x
here is the terminal output
➜ ~ brew install python
Warning: python 3.7.2 is already installed, it's just not linked
You can use `brew link python` to link this version.
➜ ~ brew link python
Linking /usr/local/Cellar/python/3.7.2... Error: Permission denied # dir_s_mkdir - /usr/local/Frameworks
➜ ~ sudo brew link python
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
➜ ~ python -V
Python 2.7.10
I think I need to modify some kind of path. And do some magic then pray...lol
Anyway anyone know how to get this work on my machine? I'm mac latest
First, solve your permission problem by running the official command from the Homebrew Documentation, Troubleshooting page
cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var opt Cellar Caskroom Frameworks
Then run brew link python
And finally run echo $PATH and check that your /usr/local/bin has precedence over other directories.
you could do brew uninstall python3 and install it from the python website here https://www.python.org/
When you go install a module you do pip3 install packageName
And when you run a program you could run it from your IDE (I recommend VSCode) or run it from the terminal with python3 drag_python_file_here
you have to use python3 instead of python on Mac so like python3 path/to/file.py and pip is now pip3 so like pip3 install pillow

Using easy_install in Ubuntu for Windows

I'm trying to install CyLP on a windows machine in the Ubuntu for Windows app. CyLP's documentation recommends using easy_install. When I run the command easy_install cylp I get the error message
error: can't create or remove files in install directory
…
[Errno 13] Permission denied:
I've also tried to run sudo easy_install cylp and sudo su and then easy_install cylp (I'm not sure why the sudo su command works to access the root user but it does) and both of these return the error
easy_install: command not found
How do I go about using easy_install for installing CyLP?
In case you're wondering why I'm using easy_install, I'm following https://github.com/coin-or/CyLP. Also, pip3 install cylp is not working; the error thrown when running that command reads
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-r0u91f_h/cylp/
Edit: this is the default Ubuntu app on the Microsoft store; I believe it's Ubuntu 18.04.
Update: I decided not to pursue this solution; I ran through the other installation process offered instead. One thing that I realized after-the-fact is that I had the 'python' command associated with Python3 and this package seems to rely on Python2.

python installing bluepy to virtualenv

I'm a *nix noob. I'm on Ubuntu 16.04.
I'm trying to install bluepy to a virtualenv. It is currently installed under my user (not a virtualenv). When running pip freeze I see it listed under my user. When I activate the virtualenv and run pip freeze it does not show up. I tried to install it under the virtualenv using the following command: sudo pip3 install bluepy. It returns this:
The directory '/home/todd/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/todd/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
I'm not sure what to do. If responding please add explanations so I can learn something. Thanks!
EDIT:
This answer did not help solve my problem. It was tailored for a Mac OS, not Ubuntu.
pip install: Please check the permissions and owner of that directory

Resources