Mercurial for Windows - Python version? - python

What version of Python is needed to run Mercurial?
I see that the website says it requires 2.4. Does that mean 2.4, or 2.x? or something higher than 2.4, i.e., could I install 3.x?
I've installed Mercurial without reading the requirements and I installed it anyway and hg.exe executes fine.
Looking in the directory that hg.exe lives (C:\Program Files\Mercurial\), it has a python26.dll in there. Does that mean i won't have to install Python - i.e. it's bundled with Mercurial?
Thanks

Yes, it comes bundled. If you install Mercurial using the Windows installer, then you don't need to worry about which version of Python you are using. Mercurial uses py2exe to create an executable that runs without a Python installation.

Python 3.x is not compatible with 2.x.
If Mercurial supports 2.4 and above, then you are better off installing python 2.6.x.
Yes there are installers available that come bundled with python.
You run the following on command line and if you do not get any errors then you are on your way to use mercurial
> hg version
> hg debuginstall
> hg test_mercurial
> cd test_mercurial

Related

How to install matlabengine (Windows 10, MATLAB R2020b, Python 3.8.10)

I have the following environment:
Windows 10
Python 3.8.10
MATLAB R2020b
I'm trying to install matlabengine (pip install matlabengine) package, and I'm getting the following error:
RuntimeError: No compatible MATLAB installation found in Windows Registry. This release of MATLAB Engine API for Python is compatible with version 9.13. The found versions were 9.9
What am I missing ? (according to https://pypi.org/project/matlabengine/) it seems I'm using the right versions.
How can I check the versions I have (9.9 or 9.13 because as I wrote above I have MATLAB R2020b and Python 3.8.10).
The error is about the MATLAB version, not the version of matlabengine (the Python module).
You wrote that you have MATLAB 2020b. That is the release name for MATLAB version 9.9, as can be seen in this table on Wikipedia.
As can be read on the description of matlabengine 9.13.1, this engine version requires MATLAB release R2022b (= 9.13).
To use matlabengine with MATLAB 2020b, install version 9.9.1:
python -m pip install matlabengine==9.9.1
You need to try all versions of MATLAB engine starting from the latest one going backwards. What worked for me on Ubuntu was
$ python -m pip install matlabengine==9.12.17
NB: To get a list of all the possible versions, try install one that doesn't exist e.g.
$ python -m pip install matlabengine==9.9.2
and it will give you an error with the list of possible versions.
You can try to install specific version of matlabengine.
pip install matlabengine==9.13.1
If they cannot find your version, you might need to update pip.
Also, you can check your current matlabengine version.
pip show matlabengine

Python version mismatch even though CMake reports having found the correct version

I'm building some C++ Python extensions for Python 3.10 (using PyBind11) but I'm finding that when trying to import these extensions I get: ImportError: Python version mismatch: module was compiled for Python 3.8, but the interpreter version is incompatible: 3.10.5.
I have find_package(Python3 3.10 REQUIRED) in my CMakeLists.txt and I use -DPYTHON_EXECUTABLE:FILEPATH=$(which python) when running cmake. I can confirm that which python points to a Python 3.10 executable. When running cmake part of the output says:
Found Python3: /PATH/TO/venv/bin/python3 (found suitable version "3.10.5", minimum required is "3.10") found components: Interpreter
and there are no other mentions of finding some other Python version. The compiled files look like module.cpython-310-x86_64-linux-gnu.so. Because of the 310 they can only be imported into a Python 3.10 interpreter sesion.
BUT, when I try importing them I get the ImportError I mentioned above. On the other hand, if I manually rename the compiled files to module.cpython-38-x86_64-linux-gnu.so and open up a Python 3.8 interpreter, I'm able to import.
How can I fix this? Why are all the clues suggesting that I have built the files correctly when I somehow haven't?
Note that I have already tried the solutions from the answers here.
There may have been other factors at play here (like including 3rd party CMake projects) so to fix my problem the first step was to remove those. Then I:
changed my find_package(Python3 3.10 REQUIRED) to find_package(Python3 3.10 REQUIRED COMPONENTS Interpreter Development) (see here). User #Tsyvarev also somewhat alluded to this in his comment on my question.
installed sudo apt install python3.10-dev (I only had this for Python 3.8). If you're like me and don't understand the difference between sudo apt install python and sudo apt install python-dev see this answer.

I have a error on installing CPLEX 12.10 to Python 3.8

I am trying to install CPLEX studio 12.10 to Python 3.8. I'm using Visual studio code editor.
Referring to https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.8.0/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/Python_setup.html, I use the command "python setup.py install --home C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\python\3.7\x64_win64". But error " can't open file 'setup.py': [Errno 2] No such file or directory" is appeared.
How to solve this problem?. I also checked that setup.py is in the above folder.
You need to find setup.py first by going the folder that CPLEX is installed (use the path you wrote after install --home). Furthermore, the path after install --home is to the directory where your Python is installed. See this answer for details.
Also, CPLEX 12.10 doesn't support Python 3.8 for now.
There is a workaround for this problem if you are able to modify the underlying python library shipped with CPLEX. Essentially, the python interface is the same, but the program will check your python version and prevent you from installing and using it if the version does not match.
Go to /path/to/installation/cplex/python, you should see 2 directories (3.6 and 3.7). Make a copy of 3.7 and rename it as your python version, for example, 3.8 or 3.9. In /path/to/installation/cplex/python/<your_python_version>/<your_os>/setup.py and /path/to/installation/cplex/python/<your_python_version>/<your_os>/cplex/_internal/_pycplex_platform.py, remove the code that checks python version.
The above is tested on x86_64 Linux with python 3.9.2 using the official docplex library (you will need to export an environmental variable, see the official documentation). I suppose if you run setup.py to install the cplex python libaray, it should also work. Beware this is not officially supported, and do it at your own risk.

What's the difference between homebrew python and caskroom python?

The page Installing Python on Mac OS X suggests that the OS X version is OK for learning but not great for writing real programs; solution - install from Homebrew.
I don't think the caskroom existed when they wrote this page though. Basically, I just want to install the most optimal version for doing Python programming.
When I do a search I get this output:
$ brew search python
boost-python gst-python python python3 wxpython zpython
Caskroom/cask/mod_python homebrew/python/vpython Caskroom/cask/python
homebrew/python/python-dbus homebrew/versions/gst-python010 Caskroom/cask/python3
This is what homebrew reports:
macosx-10-9:~ vagrant$ brew cask info python
python: 2.7.9
Python
https://www.python.org/
Not installed
https://github.com/caskroom/homebrew-cask/blob/master/Casks/python.rb
==> Contents
python-2.7.9-macosx10.6.pkg (pkg)
macosx-10-9:~ vagrant$ brew info python
python: stable 2.7.10 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org
/usr/local/Cellar/python/2.7.10_2 (4906 files, 77M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/python.rb
So, what's the effective difference between these two packages?
Caskroom python installs the Python Mac OS X packages from https://www.python.org/downloads/mac-osx/ as they are provided there.
brew install python will install from source and under /usr/local/Cellar/python/... and properly symlink /usr/local/bin/python.
The latter is the "proper homebrew approach" (TM) and will allow updates with brew upgrade.

Install Xapian for Python 2.6 on CentOS 5.5

I'm using Django 1.2 for Python 2.6 on CentOS 5.5 and I'm trying to install Django Haystack with Xapian as the search backend. I've followed the installation instructions on http://docs.haystacksearch.org/dev/installing_search_engines.html#xapian and also the instructions for the RedHat Enterprise Linux RPM package on http://xapian.org/download. Xapian has installed, but has attached itself to Python 2.4, which needs to be present in CentOS for other reasons. So, if I go into a 'python' shell and 'import xapian' it works correctly, but if I go into a 'python26' shell and 'import xapian' I get the error 'No module named Xapian'.
I then tried creating a symlink in the python 2.6 site packages to Xapian in the python 2.4 site packages and this gave me the following error when trying to import xapian in the python 2.6 shell:
RuntimeWarning: Python C API version mismatch for module _xapian: This Python has API version 1013, module _xapian has version 1012.
I've also tried to specify the python library to use when configuring xapian-core as seen on http://invisibleroads.com/tutorials/xapian-search-pylons.html#install-xapian-on-webfaction, so the command I used was:
./configure PYTHON=/usr/bin/python2.6
then for installing xapian-bindings I used:
./configure PYTHON=/usr/bin/python26 PYTHON_LIB=/usr/lib/python2.6 --with-python
This made no discernible difference so I'm a bit stuck at the moment. Does anyone have any ideas?
When building the xapian-bindings package you'll want to do ./configure --with-python PYTHON=/usr/bin/python2.6 Sounds like you were trying to do this on xapian-core, which isn't the right place.

Categories