Python version in Yade 2021.01a

Asked by mohsen

In the name god
Hi everyone
I use KUbuntu 20.04 LTS. I compile YADE 2021.01 a and run it. the terminal shows yade uses python version of 3.8.10:

..
..
Using python version: 3.8.10 (default. Sep 28 2021, 16:10:42)
..
..

However all of my script are based on the python 2. what can i do?!
Please note that my default python version is 2.7.18 although the 3.8 is installed too.

Regards

Question information

Language:
English Edit question
Status:
Expired
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

> what can i do?!

The most reasonable approach is IMO convert the scripts to version 3, either manually or e.g. using [1].

Alternatively (although I would strongly discourage this approach), for the compiled version, you can try to set PYTHON_VERSION cmake variable to 2 (see [2], search PYTHON_VERSION)

Cheers
Jan

[1] https://docs.python.org/3/library/2to3.html
[2] https://gitlab.com/yade-dev/trunk/-/blob/master/CMakeLists.txt

Revision history for this message
Robert Caulk (rcaulk) said :
#2

>>what can i do?!

Consider also that we've written a doc specifically for this: https://yade-dem.org/doc/tutorial-advanced.html?highlight=convert#convert-python-2-scripts-to-python-3.

Revision history for this message
mohsen (agha-mohsena) said :
#3

Thanks Jan Stránský, that solved my question.

Revision history for this message
mohsen (agha-mohsena) said :
#4

Dear Ian
about using Ref. [2] i think in that case we need the python 2 modules; however the prerequisites in the web page are now set for python3 [3]. how can i access the prerequisites for python2. is there any archive?

https://yade-dem.org/doc/installation.html#prerequisites

Revision history for this message
Jérôme Duriez (jduriez) said :
#5

Starting from https://yade-dem.org/doc/, and its 1st paragraph, if you follow the "backward compatibility for Python 2" link, you will eventually access that archive:

https://gitlab.com/yade-dev/trunk/-/blob/6e097e95368a9c63ce169a040f418d30c7ba307c/doc/sphinx/installation.rst

with a dedicated paragraph about Python2 dependencies.

(Personal note: living in the computers' past could sometimes be painful ?)

Revision history for this message
mohsen (agha-mohsena) said :
#6

Dear Jérôme:
thank you very much! I think you addressed me a cmake file, how ever i needed a revision of these commands compatible for python2:

sudo apt install cmake git freeglut3-dev libloki-dev libboost-all-dev fakeroot \
dpkg-dev build-essential g++ python3-dev python3-ipython python3-matplotlib \
libsqlite3-dev python3-numpy python3-tk gnuplot libgts-dev python3-pygraphviz \
libvtk6-dev libeigen3-dev python3-xlib python3-pyqt5 pyqt5-dev-tools python3-mpi4py \
python3-pyqt5.qtwebkit gtk2-engines-pixbuf python3-pyqt5.qtsvg libqglviewer-dev-qt5 \
python3-pil libjs-jquery python3-sphinx python3-git libxmu-dev libxi-dev libcgal-dev \
help2man libbz2-dev zlib1g-dev libopenblas-dev libsuitesparse-dev \
libmetis-dev python3-bibtexparser python3-future coinor-clp coinor-libclp-dev \
python3-mpmath libmpfr-dev libmpfrc++-dev libmpc-dev

And about the personal note: you are right; but i am at the middle of a work and should finish it. Hence i should try that!
Indeed i use new version of YADE for my new projects.
Regards

Revision history for this message
Launchpad Janitor (janitor) said :
#7

This question was expired because it remained in the 'Open' state without activity for the last 15 days.