I am able to successfully run virtualenv on python, not but on jython (version 2.5.2). What could be the problem and how do I fix this?
Below is the error:
Susans-MacBook-Pro:Intro_Jython susantan$ virtualenv -p jython susan_env_jy
Running virtualenv with interpreter /Users/susantan/jython2.5.2/bin/jython
ERROR: None
ERROR: this script requires Python 2.6 or greater.
Susans-MacBook-Pro:Intro_Jython susantan$ virtualenv -p python susan_env_jy
Running virtualenv with interpreter /usr/bin/python
New python executable in susan_env_jy/bin/python
Installing setuptools, pip...done.
From the Jython website:
The most current stable release of Jython is 2.5.3. For production purposes, please use this version.
From your error message:
ERROR: this script requires Python 2.6 or greater.
This is probably the cause of the problem. Jython has a 2.7beta1 which you could try.
Edit: from the virtualenv website, it looks like they dropped support for Python 2.5 in v1.10:
1.10 (2013-07-23) ~~~~~~~~~~~~~~~~~
BACKWARDS INCOMPATIBLE Dropped support for Python 2.5. The minimum
You will have to install an earlier version of virtualenv to support Jython 2.5.x
Here is a link to the previous version (1.9.1) https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz - You should be able to install this by extracting the package and running jython setup.py install from within the folder.
Related
I'm quite new to Ubuntu. On my machine, running Ubuntu 20.04 with Python 3.8, I'm trying to run a program which does not support Python 3.8, but it requires Python 3.7 (FYI, it is Carla Simulator).
I need pygame, but when installing it through pip (python3.7 -m pip install pygame) it raises an error:
ModuleNotFoundError: No module named 'distutils.util'
Now, I have distutils correctly installed and updated at version 3.8.2-1ubuntu1.
Is there any way for me to install a distutils version compatible with Python 3.7 without affecting Python 3.8 and related modules? Or do you have hany suggestion to get pygame for Python 3.7 and running Carla somehow? Could a virtual environment help?
My question is really similar to this one How to install python-distutils but I don't actually require distutils, I just need the program to work...
Thank you
----- EDIT -----
I tried creating a virtual environment using venv, but I got an error due tue unavailability of ensurepip. Googling it, I found it might be related to the fact that my Python 3.7 version might have been installed through Anaconda (I actually can't remember). Running apt-cache rdepends python3.7 I get:
python3.7
Reverse Depends:
python3.7-minimal
Is it safe to completely uninstall current Python3.7 and reinstall it to hopefully get ensurepip? Any suggested code to safely do it?
The easiest solution for you would be to run your program in a virtual environment where you would specify the default python version to be 3.7 I think (see Use different Python version with virtualenv for an example). You can then install all your dependencies inside this environment and not have to deal with any conflicts between the two versions on Python.
Using pyenv you could specify the python version you want to use.
for example:
create a new folder and hit:
pyenv local 3.7.2
then create your virtual env by using pipenv:
pipenv install
then start your journey to building your game.
hope it help.
I'm trying to install 'pymorph' on mac os x with 'PIP':
sudo pip install pymorph
I'm getting the following error:
NameError: name 'execfile' is not defined
Command "python setup.py egg_info" failed with error code 1 in
/private/tmp/pip-build-9hjd5tfm/pymorph/
I have read that using a python version different from 2.7 could lead to this kind of problem. Yet, I'm using the 2.7 version:
python --version
Python 2.7.13
Any ideas to solve this issue ?
Thank you in advance
It's possible to have a pip command on your PATH that comes from a different Python installation than the python command. (Each entry script to a Python-based tool is bound to the Python installation that was used to install the package that provided it. This means that the pip command does not search PATH for a python installation.) If this pip comes up later on PATH than python, it would lead to behaviour that you describe.
This can happen, say, if you first install a Python 2.7 without pip, and then a Python 3.x with pip, if the installers prepend to PATH.
You can verify which version of Python pip is using and where it's installed by running pip -V.
The robust solution to this should be using a virtual environment that lets you tie the base python installation and libraries specific to your application alone with your project, as well as avoid cluttering your global site-packages, and prevent inadvertent compatibility issues from different versions of the same package being needed by different projects.
It seems that the current (as of late 2017) recommended virtual environment solution is Pipenv. A decent-looking introduction to virtual environments using Pipenv, by the author of Pipenv, can be found here.
I am following this guideline to install python 2.7.11 on a CentOs shared hosting (bluehost).
I get the following error during the make install phase:
(cd /home2/some_user/python/bin; ln -s python2 python)
ln: creating symbolic link `python': Permission denied
make: *** [bininstall] Error 1
Anywhere in the guideline mentioned 2.7.2 I changed it to 2.7.11.
A few hours back I had installed 2.7.2 with no issues. I get this error when installing 2.7.11.
How can I skip this error and continue with installation of 2.7.11?
Or if there are better ways to install python 2.7.11 on shared hosting it's ok to change method.
Doing this trick solved the issue:
cd /home2/some_user/python/bin;
cp python2.7 python2
So basically I got the error when running make install, ran above commands to trick the installation there is a python2 folder exists, and then reran the make install and python was installed successfully.
Most likely in previous installations python2 was just "python2", not python2.7.
Also here is a better document discussing how to install python 2.7, and for installing 2.7.11 just change all 2.7.2 to 2.7.11. But still running this will give the above error and should do the trick to bypass the error.
I'm trying to install an older version of Python on my Mac. I'm currently running 2.7.9, but our production environment is running 2.7.6. (There is a compatibility issue with gevent and 2.7.9.)
I found pyenv which allows me to install various versions. I've installed pyenv with brew and installed 2.7.6. I then created a virtualenv with 2.7.6 with the following command:
mkvirtualenv my_env --python=/Users/dustin/.pyenv/versions/2.7.6/bin/python
It seems to work fine and I'm running Python 2.7.6. The problem I am running into is that I can't install certain packages with pip such as Cython or M2crypto. I get C compile errors.
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
If I create a virtualenv without specifying the Python version, these packages install fine. How do I fix this?
It could be due to trying to run an older version of Python 2.7.x (like 2.7.6) on newer releases of OS X. If you are on OS X 10.10, that's very likely the problem. See http://bugs.python.org/issue21811. You may need to add at least the patch for _osx_support.py. If not, try running pip with -v and update your question with the results.
Update: With the additional information you supplied, it is clear that you are running into the OS X 10.10 support issues that were fixed in the changes for Issue21811 released in 2.7.8. In particular, the configure changes are needed to correctly parse the two-digit minor version number (10); otherwise, the code in configure mistakenly thinks you are are running on a very old version of OS X and generates obsolete link directives. You should backport https://hg.python.org/cpython/rev/2672e30d9095 and https://hg.python.org/cpython/rev/a7ab09e00dbc.
I'm using ubuntu 12.10 with default python3.2. However I downloaded python 3.3 as its much more polished. Of course, since then I have a nightmare with installing modules for 3.3, as python3 packages from synaptic install to 3.2 dir. So, I installed pip using python 3.3. Now I have pip-3.3 command, great. But, when I tried "sudo pip-3.3 install PySide" I quickly got an error: "error: Failed to locate the Python library /usr/lib/libpython3.3m.so". What's more, when I run "sudo pip install PySide" (command for 2.7), it builded and installed and runs flawlessy. Pyvenv and virtualenv both fail too. But I wan't to do it non-env way,just install pyside to global 3.3 lib dir.
So how can I install that PySide to python 3.3? I just can't get it to work... It looks like I will have to stick with default ubuntu python 3 version (this one runs great, everything works both from pip and synaptic), but I like to use newest python as it gets better and better with every release.
Btw, if that matters I also got following warning before that error:
"package init file 'PySide/init.py' not found (or not a regular file)" and
"package init file 'pysideuic/init.py' not found (or not a regular file)"
Edit: I installed full python3.3 from synaptic, including pythoh3.3-dev, debug, lib etc. Everything.
And that dynamic python 3.3 lib exist in /usr/lib/x86_64-linux-gnu/libpython3.3m.so, maybe just python3.3 package for ubuntu is poor and installs it in wrong direction/doesn't do any symlinks tricks?
Please try this answer installing from source (PySide). Download pyside sources and install from source, follow the instructions on the link.