Cannot install rpy2 via pip in MAC OS - python

I cannot install rpy2(Python package) via pip or PyCharm in MAC OS.
But I can run Python(via PyCharm) and R(via RStudio) successfully.....
The main error message is
"Error: Tried to guess R's HOME but no command (R) in the PATH." and "Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-OtKzsd/rpy2/".
I guess the problem maybe related to R environment PATH setting?
But I still don't know how to fix this problem....
The complete error message is below:
host-217:~ ChenGuanYing$ sudo pip install rpy2
The directory '/Users/ChenGuanYing/Library/Caches/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 '/Users/ChenGuanYing/Library/Caches/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.
Collecting rpy2
Downloading rpy2-2.7.8.tar.gz (178kB)
100% |████████████████████████████████| 184kB 1.1MB/s
Complete output from command python setup.py egg_info:
Error: Tried to guess R's HOME but no command (R) in the PATH.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-OtKzsd/rpy2/

Two possible solutions, as suggested in the error message:
export R_HOME=
put R command in the system PATH

Related

Python - Installation build wheel error when installing from local directory

I want to install a package from GitHub that uses Cython (https://github.com/mlysy/kalmantv). I cloned the package locally, and after trying to install it with pip install ., I'm getting the following error:
DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
Processing /Users/me/Downloads/kalmantv
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /Users/me/.pyenv/versions/3.8.3/bin/python3.8 /Users/me/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/g1/0pjsd_bs24jgccrd6g0lzfvc0000gn/T/tmpxmrdlgnk
cwd: /Users/me/Downloads/kalmantv
Complete output (6 lines):
running egg_info
writing kalmantv.egg-info/PKG-INFO
writing dependency_links to kalmantv.egg-info/dependency_links.txt
writing requirements to kalmantv.egg-info/requires.txt
writing top-level names to kalmantv.egg-info/top_level.txt
error: package directory 'eigen-3.3.7' does not exist
----------------------------------------
WARNING: Discarding file:///Users/me/Downloads/kalmantv. Command errored out with exit status 1: /Users/me/.pyenv/versions/3.8.3/bin/python3.8 /Users/me/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/g1/0pjsd_bs24jgccrd6g0lzfvc0000gn/T/tmpxmrdlgnk Check the logs for full command output.
ERROR: Command errored out with exit status 1: /Users/me/.pyenv/versions/3.8.3/bin/python3.8 /Users/me/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/g1/0pjsd_bs24jgccrd6g0lzfvc0000gn/T/tmpxmrdlgnk Check the logs for full command output.
I tried adding --use-feature=in-tree-build from the deprecation warning but still got the error (without the initial warning).
I saw a number of suggestions such as using pip install --upgrade pip setuptools wheel, but nothing is doing the trick. I would guess that this has a simple fix but this stuff is a little over my head and I don't want to break anything else.
What do I need to do to safely correct this issue without causing other problems?
The setup.py file has the following lines:
# path to eigen library
EIGEN_PATH = r"eigen-3.3.7"
Strangely, it seems to expect the Eigen header library to be present at that location. You can install the library with brew install eigen, or sudo apt install libeigen3-dev. Note that this may not install version 3.3.7 of the library, which the project expects. I don't know if using a newer version would cause any issues.
If you want to install version 3.3.7, you can build and install it from source with the following link by following these instructions:
https://gitlab.com/libeigen/eigen/-/releases/3.3.7
Once that's done, change to the project directory, and create a symlink to the Eigen library:
If installed with brew: ln -s /usr/local/Cellar/eigen/*/include/eigen3 eigen-3.3.7
If installed with apt: ln -s /usr/include/eigen3 eigen-3.3.7
If installed from source: /usr/local/include/eigen3 eigen-3.3.7
Once the Eigen library has been installed and made available at ./eigen-3.3.7, pip install . should work, but for good measures you should run the following command first:
pip install -U pip setuptools wheel; pip install -U cython
Refer to Catalina C++: Using <cmath> headers yield error: no member named 'signbit' in the global namespace if you run into an error like: error: no member named 'signbit' in the global namespace.

I have a problem with running the mkdocs serve command

I tried running the mkdocs serve command on the windows command prompt but it wasn't working. I get the following error:INFO - Building documentation...
ERROR - Config value: 'markdown_extensions'. Error: Failed loading extension "mdx_math".
Aborted with 1 Configuration Errors!
I then noticed that my terminal directory wasn't on the mkdocs.yml file as stated in the MkDocs Website but when I ran cd command to change the directory to the mkdocs.yml, I got the following error:The directory name is invalid.
How do I fix this?
It appears that your extension isn't installed.
Try: pip install mdx_math
Please install the missing extensions by
pip install python-markdown-math

Pycharm with virtualenv, use Shelve module: No module named _bsddb

I receive the error "No module named _bsddb".
I installed berkeley-db4 using Brew.
I load up the virtualenv and use "pip install bsddb3 --install-option="--berkeley-db='/usr/local/opt/berkeley-db4'" but I can't get passed this in any way I can think of:
Collecting bsddb3
Using cached bsddb3-6.1.1.tar.gz
Complete output from command python setup.py egg_info:
Can't find a local Berkeley DB installation.
(suggestion: try the --berkeley-db=/path/to/bsddb option)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/g6/j96dym1x0jx9ydrdkfs4dhnr0000gn/T/pip-build-676fDz/bsddb3
This is probably OS X only, because the shipped Python has something broken regarding berkeley-db and/or bsddb.
The solution:
Install brew and use brew to install python
After this 'which python' should pount to '/usr/local/bin/python'
Create a new virtualenv using Terminal OUTSIDE OF PYCHARM
In Pycharm's Project Interpreter settings choose 'Add Local'
Select the python bin inside your virtualenv directory

Pylibnet installation error ubuntu 14

I've been looking in the internet for a solution of this issue when i try to install pylibnet , i would like to know if you guys were be able to install pylibnet succesfully and how.
Thanks
root#root:/home/core2# pip install ./pylibnet-3.0-beta-rc1.tar.gz
Unpacking ./pylibnet-3.0-beta-rc1.tar.gz
Running setup.py (path:/tmp/pip-LSMFJM-build/setup.py) egg_info for package from file:///home/core/pylibnet-3.0-beta-rc1.tar.gz
Searching for libnet...
Could not locate the static library "libnet.a"
Complete output from command python setup.py egg_info:
Searching for libnet...
Could not locate the static library "libnet.a"
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 255 in /tmp/pip-LSMFJM-build
Storing debug log for failure in /root/.pip/pip.log
Try runnning
$ find / | grep libnet.a
or
$ locate libnet.a
and if it is found somewhere then move it to /usr/lib/libnet.a because this is where pip looks for it when it trys to install pylibnet e.g.
$ sudo cp /usr/lib/i386-linux-gnu/libnet.a /usr/lib/libnet.a
this worked for me :-)

Can't figure out where Heroku app is failing [Error: pg_config executable not found.]

Hoping you can help me figure this one out. I'm slogging through the Heroku 'Getting Started with Python' page where you install the necessary dependencies to run an app locally. It all works well up until the 2nd to last step, running the command virtualenv venv. I run that, then the next command, pip install -r requirements.txt --allow-all-external, and that's where I get this error:
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_nickcode/psycopg2
Storing debug log for failure in /tmp/tmpb5tCeK
I don't understand why I'm getting this error. Can anyone help me make sense of it?
My version of requirements.txt:
dj-database-url==0.3.0
Django==1.8.1
django-postgrespool==0.3.0
gunicorn==19.3.0
psycopg2==2.6
SQLAlchemy==1.0.4
whitenoise==1.0.6
pg_config is part of postgresql ( http://www.postgresql.org/docs/8.1/static/app-pgconfig.html ).
So you need to install postgresql.
brew install postgresql
resolves this issue on macOS
I have overcame this issue defining a environment variable HEROKU and putting the following lines at the end of settings.py
if config('HEROKU', cast=bool, default=False):
import django_heroku
django_heroku.settings(locals())
As Heroku use the buildpack: heroku/python, there is no additional configuration to perform

Categories