Python Forum
Attempt to build python 3.7.0 on OpenSuse Leap 15
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Attempt to build python 3.7.0 on OpenSuse Leap 15
#1
I attempted to build Python 3.7.0 on OpenSuse Leap 15.
The compile was successful (or at least it got to testing phase), but failed on _hashlib with following error.
UserWarning: Did a C extension fail to compile? No module named '_hashlib' warnings.warn('Did a C extension fail to compile? %s' % error)
I was attempting to create a tutorial for doing this. I think I had enough for one day, and will pick up again tomorrow.

If anyone has had a similar experience, I'd like to know the resolution.

Here's my step by step up to the error:
Output:
Step 1: If you don't already have a source repository for python, do the following: A. cd to your chosen location for a python repository B. mkdir PythonSource C. cd Python Source D. mkdir OpenSuse E. cd OpenSuse F. mkdir Python3.7.0 G. cd Python3.7.0 Step 2: If you don't have a favorite editor, I suggest downloading notepadqq (Almost if not identical to Notepad++) sudo zipper install notepadqq Step 3: Download python source: https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz Step 4: Make sure compiler present: which gcc A. If not found: sudo zipper install gcc Step 5: Unzip tar file: tar zxvf ./Python-3.7.0.tgz Step 6: Change directory to Python-3.7.0: cd Python-3.7.0/ Step 7: Create makefile: ./configure --prefix=/opt/python3.7.0 --with-pydebug --enable-optimizations --enable-shared A. If you don't see a makefile (with correct timestamp), you will need to find ouy why. B. Open Config.log in notepadqq and search for the part that comes between 'Core tests' and 'Cache variables' and see what went wrong. C. Usually this will only happen if a core dependency is missing, and that can be installed with zypper as above. Step 8: Once configure runs to completion, and you have a makefile, Run the makefile with command: make Step 9: After compile, tests will be run .. This can take quite some time: A. Example output: Run tests sequentially 0:00:00 load avg: 1.08 [ 1/415] test_grammar 0:00:00 load avg: 1.08 [ 2/415] test_opcodes 0:00:00 load avg: 1.08 [ 3/415] test_dict 0:00:01 load avg: 1.08 [ 4/415] test_builtin 0:00:02 load avg: 1.08 [ 5/415] test_exceptions 0:00:05 load avg: 1.07 [ 6/415] test_types 0:00:05 load avg: 1.07 [ 7/415] test_unittest 0:00:15 load avg: 1.14 [ 8/415] test_doctest 0:00:20 load avg: 1.13 [ 9/415] test_doctest2 0:00:20 load avg: 1.13 [ 10/415] test_support 0:00:40 load avg: 1.09 [ 11/415] test___all__ B. When encountered, testing errors will look like: /run/media/Larz60p/Development/development/downloads/p-r/p/pv-pz/pyo-pyz/python/OpenSuse/Python-3.7.0/Python-3.7.0/Lib/test/test_hashlib.py:90: UserWarning: Did a C extension fail to compile? No module named '_hashlib' warnings.warn('Did a C extension fail to compile? %s' % error) To find the cause (this specific error), search config.log
Reply
#2
I would have used pyenv.
A intro for OpenSuse,my tutorial

How it look for me on Mint.
# Update pyenv
mint@mint ~ $ pyenv update

# Look at what's available
mint@mint ~ $ pyenv install --list
Available versions:
....
3.6.6
  3.6.6rc1
  3.7.0
  3.7-dev
  3.8-dev
....

# Update needed
sudo apt-get update
sudo apt-get install libffi-dev

# install
mint@mint ~ $ pyenv install 3.7.0
Installing Python-3.7.0...
Installed Python-3.7.0 to /home/mint/.pyenv/versions/3.7.0

# Set python and pip to point to 3.7
mint@mint ~ $ pyenv global 3.7.0
mint@mint ~ $ python -V
Python 3.7.0
mint@mint ~ $ pip -V
pip 10.0.1 from /home/mint/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pip (python 3.7)
mint@mint ~ $ 
# Finish
 
Reply
#3
I followed instructions here for install of pyenv: https://github.com/pyenv/pyenv#basic-github-checkout

I thought I had properly installed pyenv on my system, but when trying to find it, it's not there:
Output:
Larz60p@linux-nnem:~> which pyenv which: no pyenv in (/home/Larz60p/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/sbin) Larz60p@linux-nnem:~> sudo apt-get install -y build-essential libbz2-dev libssl-dev libreadline-dev libsqlite3-dev tk-dev [sudo] password for root: Loading repository data... Reading installed packages... Package 'build-essential' not found. 'libreadline-devel' not found in package names. Trying capabilities. No provider of 'libreadline-devel' found. 'libsqlite3-devel' not found in package names. Trying capabilities. No provider of 'libsqlite3-devel' found. 'libssl-devel' not found in package names. Trying capabilities. No provider of 'libssl-devel' found. Larz60p@linux-nnem:~>
Haven't been on Linux for a few yeas, so not up to date on advancements. The old stiff is coming back quickly, like playing piano.

Now I will try from your link: https://gist.github.com/antivanov/01ed4e...8b5a0a4ac7 and report back.
Reply
#4
Still something missing:
Output:
Larz60p@linux-nnem:~> git clone https://github.com/pyenv/pyenv.git ~/.pyenv Cloning into '/home/Larz60p/.pyenv'... remote: Counting objects: 16417, done. remote: Compressing objects: 100% (24/24), done. remote: Total 16417 (delta 17), reused 41 (delta 17), pack-reused 16371 Receiving objects: 100% (16417/16417), 3.18 MiB | 8.71 MiB/s, done. Resolving deltas: 100% (11142/11142), done. Larz60p@linux-nnem:~> echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc Larz60p@linux-nnem:~> echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc Larz60p@linux-nnem:~> echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc Larz60p@linux-nnem:~> sudo zypper install readline-devel sqlite3-devel libbz2-devel zlib-devel libopenssl-devel [sudo] password for root: Loading repository data... Reading installed packages... Resolving package dependencies... The following 8 NEW packages are going to be installed: libbz2-devel libopenssl-1_1-devel libopenssl-devel ncurses-devel readline-devel sqlite3-devel tack zlib-devel The following package is suggested, but will not be installed: sqlite3-doc 8 new packages to install. Overall download size: 6.4 MiB. Already cached: 0 B. After the operation, additional 18.9 MiB will be used. Continue? [y/n/...? shows all options] (y): y Retrieving package libbz2-devel-1.0.6-lp150.3.17.x86_64 (1/8), 18.9 KiB ( 19.3 KiB unpacked) Retrieving: libbz2-devel-1.0.6-lp150.3.17.x86_64.rpm ................................[done (1.1 KiB/s)] Retrieving package sqlite3-devel-3.23.1-lp150.1.1.x86_64 (2/8), 206.6 KiB (550.1 KiB unpacked) Retrieving: sqlite3-devel-3.23.1-lp150.1.1.x86_64.rpm ...........................................[done] Retrieving package tack-6.1-lp150.3.14.x86_64 (3/8), 269.6 KiB (220.7 KiB unpacked) Retrieving: tack-6.1-lp150.3.14.x86_64.rpm ......................................................[done] Retrieving package zlib-devel-1.2.11-lp150.1.49.x86_64 (4/8), 115.5 KiB (385.9 KiB unpacked) Retrieving: zlib-devel-1.2.11-lp150.1.49.x86_64.rpm .................................[done (1.1 KiB/s)] Retrieving package ncurses-devel-6.1-lp150.3.14.x86_64 (5/8), 5.4 MiB ( 16.5 MiB unpacked) Retrieving: ncurses-devel-6.1-lp150.3.14.x86_64.rpm .................................[done (3.3 MiB/s)] Retrieving package libopenssl-1_1-devel-1.1.0h-lp150.2.1.x86_64 (6/8), 245.7 KiB ( 1.2 MiB unpacked) Retrieving: libopenssl-1_1-devel-1.1.0h-lp150.2.1.x86_64.rpm ......................[done (110.7 KiB/s)] Retrieving package readline-devel-7.0-lp150.7.8.x86_64 (7/8), 82.8 KiB ( 66.8 KiB unpacked) Retrieving: readline-devel-7.0-lp150.7.8.x86_64.rpm .............................................[done] Retrieving package libopenssl-devel-1.1.0h-lp150.1.1.noarch (8/8), 49.0 KiB ( 246 B unpacked) Retrieving: libopenssl-devel-1.1.0h-lp150.1.1.noarch.rpm ........................................[done] Checking for file conflicts: ....................................................................[done] (1/8) Installing: libbz2-devel-1.0.6-lp150.3.17.x86_64 ..........................................[done] (2/8) Installing: sqlite3-devel-3.23.1-lp150.1.1.x86_64 .........................................[done] (3/8) Installing: tack-6.1-lp150.3.14.x86_64 ....................................................[done] (4/8) Installing: zlib-devel-1.2.11-lp150.1.49.x86_64 ...........................................[done] (5/8) Installing: ncurses-devel-6.1-lp150.3.14.x86_64 ...........................................[done] (6/8) Installing: libopenssl-1_1-devel-1.1.0h-lp150.2.1.x86_64 ..................................[done] (7/8) Installing: readline-devel-7.0-lp150.7.8.x86_64 ...........................................[done] (8/8) Installing: libopenssl-devel-1.1.0h-lp150.1.1.noarch ......................................[done] Larz60p@linux-nnem:~> pyenv install python 3.7.0 If 'pyenv' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf pyenv Larz60p@linux-nnem:~> cnf pyenv pyenv: command not found Larz60p@linux-nnem:~> which pyenv which: no pyenv in (/home/Larz60p/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/sbin) Larz60p@linux-nnem:~>
Reply
#5
path issue, it's compiling now. Thanks for the advise!
Reply
#6
Python 3.7.0 (default, Jun 29 2018, 22:38:57)
[GCC 7.3.1 20180323 [gcc-7-branch revision 258812]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('Done')
Done
>>>
Reply
#7
Snippsat. I used your methods to create the virtual environment in ~/pythons, and all works, but want to verify that the activate script is no longer needed (because I can't find one in the bin directory).

... Just noticed that the last command was: source ./python3.6.3/bin/activate
so I don't understand why I can't find one.
Here's a snapshot of my bin directory:
Output:
Larz60p@linux-nnem:~/pythons/python3.7.0/bin> ls -latr total 13992 drwxr-xr-x 5 Larz60p users 43 Jun 30 21:32 .. -rwxr-xr-x 1 Larz60p users 14325280 Jun 30 21:32 python3.7 lrwxrwxrwx 1 Larz60p users 9 Jun 30 21:32 python3 -> python3.7 lrwxrwxrwx 1 Larz60p users 9 Jun 30 21:32 python -> python3.7 drwxr-xr-x 2 Larz60p users 52 Jun 30 21:32 . Larz60p@linux-nnem:~/pythons/python3.7.0/bin>
Reply
#8
(Jul-01-2018, 01:34 AM)Larz60+ Wrote: but want to verify that the activate script is no longer needed (because I can't find one in the bin directory).
It should be just the same as before using venv(also it's builds into python).
Here a test using 3.7:
mint@mint / $ python -V
Python 3.7.0

# Make 
mint@mint ~ $ python -m venv env_test

# Cd in
mint@mint ~ $ cd env_test

# Activate
mint@mint ~/env_test $ source bin/activate

# Test python an pip using environment 
(env_test) mint@mint ~/env_test $ which python
/home/mint/env_test/bin/python

(env_test) mint@mint ~/env_test $ pip -V
pip 10.0.1 from /home/mint/env_test/lib/python3.7/site-packages/pip (python 3.7)
There is no difference compare to 3.6.
The bin folder get generated when using venv.
A look at bin folder in environment,there is a activate file there.
env_test) mint@mint ~/env_test $ ls bin
activate  activate.csh  activate.fish  easy_install  easy_install-3.7  pip  pip3  pip3.7  python  python3
Reply
#9
I did a rerun, and there was an error that I didn't see, it was pretty blatant, but still didn't see it.
Here's the output:
Output:
Larz60p@linux-nnem:~> mkdir ~/pythons Larz60p@linux-nnem:~> cd ~/pythons Larz60p@linux-nnem:~/pythons> virtualenv -p ~/.pyenv/versions/3.7.0/bin/python3.7 python3.7.0 Running virtualenv with interpreter /home/Larz60p/.pyenv/versions/3.7.0/bin/python3.7 Using base prefix '/home/Larz60p/.pyenv/versions/3.7.0' /usr/lib/python3.6/site-packages/virtualenv.py:1039: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp New python executable in /home/Larz60p/pythons/python3.7.0/bin/python3.7 Also creating executable in /home/Larz60p/pythons/python3.7.0/bin/python Installing setuptools, pip, wheel... Complete output from command /home/Larz60p/python...n3.7.0/bin/python3.7 - setuptools pip wheel: Traceback (most recent call last): File "<stdin>", line 9, in <module> File "/home/Larz60p/.pyenv/versions/3.7.0/lib/python3.7/pkgutil.py", line 627, in get_data importlib._bootstrap._load(spec)) File "<frozen importlib._bootstrap>", line 696, in _load File "<frozen importlib._bootstrap>", line 668, in _load_unlocked File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible File "/usr/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_vendor/requests/__init__.py", line 83, in <module> File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 668, in _load_unlocked File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible File "/usr/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/__init__.py", line 42, in <module> File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 668, in _load_unlocked File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible File "/usr/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/cmdoptions.py", line 16, in <module> File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 668, in _load_unlocked File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible File "/usr/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 25, in <module> File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 668, in _load_unlocked File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible File "/usr/lib/python3.6/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 326, in <module> AttributeError: module 'pip._vendor.requests' has no attribute 'Session' ---------------------------------------- ...Installing setuptools, pip, wheel...done. Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/virtualenv.py", line 2328, in <module> main() File "/usr/lib/python3.6/site-packages/virtualenv.py", line 713, in main symlink=options.symlink) File "/usr/lib/python3.6/site-packages/virtualenv.py", line 945, in create_environment download=download, File "/usr/lib/python3.6/site-packages/virtualenv.py", line 901, in install_wheel call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT) File "/usr/lib/python3.6/site-packages/virtualenv.py", line 797, in call_subprocess % (cmd_desc, proc.returncode)) OSError: Command /home/Larz60p/python...n3.7.0/bin/python3.7 - setuptools pip wheel failed with error code 1 Larz60p@linux-nnem:~/pythons>
Clumsy with Linux, not sure what needs to be done.
Reply
#10
You are using virtualenv also not the build into Python venv.
Just to be clear so is not 3-party virtualenv needed anymore.

It aslo a mess as you start on 3.7 and then it jump over to "/usr/lib/python3.6/site-packages/virtualenv_support/..
It should of course not jump over to 3.6.

Try to do exactly what i posted,also using venv that's build into 3.7.
Make sure that python and pip point to 3.7,for me is okay as i use pyenv
You may need to use python3 and pip3.
Example:
mint@mint ~ $ python3 -V
Python 3.7.0

mint@mint ~ $ which python3
/home/mint/.pyenv/shims/python3

mint@mint ~ $ pip3 -V
pip 10.0.1 from /home/mint/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pip (python 3.7)
mint@mint ~ $ 
So all is correct and ponting to 3.7,now follow my post using venv.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  attempt to split values from within a dataframe column mbrown009 8 2,217 Apr-10-2023, 02:06 AM
Last Post: mbrown009

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020