Thursday, February 1, 2024

Install Python 3.11 && PyCharm on openSUSE Tumbleweed along with Python 3.12

 Following post is a compilation from several sources, which looked unexpectedly complicated due to I was unable to find out the way of installation like on the known Linux flavors (Fedora,Debian,Ubuntu).  Actually "pyenv install 3.1(X)" appears to be the build via original python's tar ball. Before you can use a specific Python version, you need to install and configure pyenv. The last part of the post describes setup Python 3.12 along with 3.11.7 and switching PyCharm to python 3.12.1 interpreter. Current version of kernel on Tumbleweed is 6.7.2 .

Proceed as follows:

    Install the pyenv package:Your system is ready now. The pyenv command downloads the requested version, compiles it and stores it under ~/.pyenv/versions/. Once this is done, you can use your new Python version in the shell.

     $ sudo zypper install --details pyenv
    To obtain the most recent state of pyenv (updated 02/27/24) :
    $ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
    Second option does allow setup Python 3.12.2 on Tumbleweed

    Install the following devel packages that are needed to build Python:

     $ sudo zypper install -y gcc automake bzip2 libbz2-devel \
       xz xz-devel openssl-devel ncurses-devel readline-devel \
       zlib-devel tk-devel libffi-devel sqlite3-devel \
       gdbm-devel make findutils patch

    Add the following lines to your ~/.bashrc file:

$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
        $ echo 'command -v pyenv >/dev/null ||  \
           export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
        $ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
When done restart terminal session either issue exec $SHELL 
Install a Python version, for example 3.11:
 $ pyenv install 3.11  ( it builds via tar ball on Suse Tumbleweed )
  boris@localhost:~> pyenv install 3.11
  Downloading Python-3.11.7.tar.xz...
  -> https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tar.xz
  Installing Python-3.11.7...
  Installed Python-3.11.7 to /home/boris/.pyenv/versions/3.11.7

Set this version for your specific user:

 $ pyenv global 3.11
Your system is ready now. The pyenv command downloads the requested 
version, compiles it and stores it under ~/.pyenv/versions/. 
Once this is done, you can use your new Python version in the shell.
Check if pip3 resolves to the local installation:
 $ pip3.11 --version
 pip 23.1.2 from /home/tux/.pyenv/versions/3.11.7/lib/python3.11/site-packages/pip (python 3.11)
You should see a directory that points to the user, not starting with /usr/.
Next "Howto" recommends installation PyCharm on Suse Tumleweed via snapd
Install pycharm-community on openSUSE   && now we are going to test 
Code provided in post Convertion format XLSX into CSV on Fedora 39 (Python 3.12.1)





























































Setup Python 3.12 along with 3.11.7
===========================
boris@localhost:~> pyenv install 3.12
Downloading Python-3.12.1.tar.xz...
Installing Python-3.12.1...
Installed Python-3.12.1 to /home/boris/.pyenv/versions/3.12.1
boris@localhost:~>pyenv global 3.11.7 3.12.1
boris@localhost:~> pip3.12 --version
pip 23.2.1 from /home/boris/.pyenv/versions/3.12.1/lib/python3.12/site-packages/pip (python 3.12)

Switching PyCharm to python 3.12.1














Import Numpy and matplotlib in PyCharm project running by Python 3.12.1 ( versions 3.11.7 and 3.12.1 running simaltenously on openSuse Tumbleweed kernel 6.7.2 )




I've just have decided to share this numbers. Looks like install PyCharm 2023.3.3 via snap on Tumbleweed and F39 is important to have issue with importing numpy, matplotlib, scipy, pandas, openpyxl and etc been resolved when Python 3.12  is used as project's interpeter .

UPDATE as of 02/07/24




References

No comments:

Post a Comment