I'm trying to install Mujoco on a Ubuntu server and have a problem which very much looks like this: https://github.com/openai/mujoco-py/issues/265
The solution in that issue thread is to install the devel version of python3. Apparently that brings in python.h which is needed by Mujoco.
But things are complicated: I don't have root access on the machine. Pip comes from a conda environment and even on conda-forge, I don't see any dev version of python (Equivalent of apt-get install python3.6-dev for conda)
The installation guide for the server installs some packages with linuxbrew. There is a python package on brew and apparently it automatically ships with the python devel version: how to install python-devel in Mac OS?
Now I have anaconda python and brew python. How can I see which paths are picked up by pip and verify if it sees the python dev headers ?
Related
I am working on ubuntu, I have python 3.8 as standard installation.
However as my project have dependency on python 3.7 I have installed 3.7 and removed 3.8
now when I am trying to install pip it is installing python3.8 again and getting installed with 3.8.
I am using apt-get -y install pip to install pip.
I want to install pip on top of my python3.7 installation so that pip uses python3.7
my project have dependency on python 3.7
This is where virtual environments really useful. The idea is that you create an environment in which the required version of python and packages can live without altering the installation of python you might want to keep installed for other projects.
There are a few options, but Anaconda / miniconda are a popular way of using virtual environments and fairly easy to use. First you'll need to install miniconda:
https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html
After that from a terminal you need to create your new environment
conda create -n "py3p7" python=3.7
Then activate it:
conda activate py3p7
Then check that you've got pip installed and it's installed under the right python version:
pip --version
Which for me returns:
pip 22.2.2 from /home/MY_NAME/miniconda3/envs/py3p7/lib/python3.7/site-packages/pip (python 3.7)
I was looking for this information for a while, but as additional packages and python versions can be installed through homebrew and pip I have the feeling that my environment is messed up. Furthermore a long time ago, I had installed some stuff with sudo pip install and as well sudo python ~/get-pip.py.
Is there a trivial way of removing all danging dependencies and have python as it was when I first got the machine, or at least with only the packages that are delivered with the Mac distro?
first delete directories where python is installed. you can find these using
$ which python
$ which python3
then use
$ brew doctor
you will find broken links which can be removed using --> $ brew prune
finally, you should reinstall python using homebrew
hope this helps.
For the system modules you installed via pip, I would do a:
sudo pip freeze > system_modules.txt
sudo pip uninstall -y -r system_modules.txt
If you also did the same as a user, I would do the same without sudo (and changing the filename)
For homebrew, you can try remove python and just install it again:
brew uninstall --ignore-dependencies python
brew uninstall --ignore-dependencies python3
I recommend you to install virtualenv as soon as you reinstall python
then you can just create a new virtual environment:
virtualenv new_env
activate it:
source new_env/bin/activate
and work there, and if at some point you mess up some packages, you can just remove the directory.
After the activation you will be able to pip install any package and it will remain inside new_env.
I've created python virtual environment, installed django using pip and now I would like to install Pillow and MySQL-python using pip but it fails during compile process.
(starting with python.h no such file or directory)
Has anyone tried intall some of these on 1and1 hosting ?
Maybe compile it on different machine or other solution ?
There's not really enough detail here to help. But one possibility is that you don't have the development package for python installed. If you are using Debian or Ubuntu, you can do sudo apt-get install python-dev to install it.
I am attempting to install a package for python3.4 on Mac OSX 10.9.4. As you know, python ships with OSX, so when I installed python3.4 I was happy to find that it came with its own version of pip, that would install packages to it (installing pip on a mac with multiple versions of python will cause it to install on the system's python2.7.)
I had previously tried installing this package (https://pypi.python.org/pypi/chrome/0.0.1) with my first installation of pip (the one tied to python2.7) and found that it successfully installed on that version, but not on any others.
I ran an install with the new pip keyword for python3.4 (which when called by itself spits out the help page so i know it works) and it told me that the package was already installed and to try updating. The update revealed that I already had the most recent version. so I tried uninstalling it from just the python3.4 and reinstalling to no avail, and got the same results when uninstalling pip from python2.7 and reinstalling only on version 3.4.
I know that's a bit hard to follow but hopefully that makes sense.
I also reviewed the content here with no success.
RESOLVED:
while python did have a directory named the same as a directory it uses with packages, this was not the correct directory, for me it was in a subdirectory of library. while documentation said that referencing pip2 would cause the package to install on python3.4, this was false. however, referencing pip3.4 worked for me.
My suggestion is that you start using virtualenv.
Assuming you have 3.4 installed, then you should also have pyvenv. As for pip and 3.4, it should already be installed.
Using for example version 3.4 create your own virtual environment and activate it:
$ mkdir ~/venv
$ pyvenv-3.4 ~/venv/py34
$ source ~/venv/py34/bin/activate
$ deactive # does what is says...
$ source ~/venv/py34/bin/activate
$ pip install ... # whatever package you need
With version 2.7 first install virtualenv and then create your own virtual environment and activate it. Make sure that setuptools and pip are updated:
$ virtualenv-2.7 ~/venv/venv27
$ . ~/venv/venv27/bin/activate
$ pip install -U setuptools
$ pip install -U pip
$ pip install ... # whatever package you need
Before asking my question, let me introduce my computing environment first.
OS: Red Hat Enterprise Linux Server 6.5.
Python: Python 2.6 (by rpm install), Python 2.7 (based on virtualenv)
Question:
I want to install a library that requires python-devel. However, when using
yum install python-devel
The system installs python-devel-2.6.*, because the installed (yum-packaged) python is version 2.6. My question is , how to install python-devel that matches the version of the python in virtualenv (which is version 2.7 in my case).
Thanks!
This question has nothing to do with pip or virtualenv. python-dev is a Linux system package, not something you install with pip. You just need to explicitly install python-devel-2.7 - you can search your distribution's package repository for the exact package name.