Issue installing python 3.6.8 on Mac M1 - python

I'm trying to run an old app that requires python =3.6.8 on Mac M1 machine with Monterey OS X 12.6.1.
I've installed pyenv-virtualenv and pyenv and successfully installed python 3.6.15. However, when I try to install 3.6.8, I'm getting error -
~ % pyenv86 install --patch 3.6.8 <<(curl -sSL https://raw.githubusercontent.com/pyenv/pyenv/master/plugins/python-build/share/python-build/patches/3.6.8/Python-3.6.8/0008-bpo-45405-Prevent-internal-configure-error-when-runn.patch\?full_index\=1)
Error: No available formula with the name "openssl#1.0". Did you mean openssl#1.1 or openssl#3?
Downloading openssl-1.1.0j.tar.gz...
-> https://www.openssl.org/source/old/1.1.0/openssl-1.1.0j.tar.gz
Installing openssl-1.1.0j...
Installed openssl-1.1.0j to /Users/lokesh.raizada/.pyenv/versions/3.6.8
python-build: use readline from homebrew
Downloading Python-3.6.8.tar.xz...
-> https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
Installing Python-3.6.8...
patch unexpectedly ends in middle of line
patch: **** Only garbage was found in the patch input.
BUILD FAILED (OS X 12.6.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/41/4c6czpkx6c18sfcfj0lzjkd00000gq/T/python-build.20230127152902.5735
Results logged to /var/folders/41/4c6czpkx6c18sfcfj0lzjkd00000gq/T/python-build.20230127152902.5735.log
Last 10 log lines:
/Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509_REVOKED_get_ext.html -> /Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509v3_get_ext_by_NID.html
/Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509_REVOKED_get_ext_by_NID.html -> /Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509v3_get_ext_by_NID.html
/Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509_REVOKED_get_ext_by_OBJ.html -> /Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509v3_get_ext_by_NID.html
/Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509_REVOKED_get_ext_by_critical.html -> /Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509v3_get_ext_by_NID.html
/Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509_REVOKED_delete_ext.html -> /Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509v3_get_ext_by_NID.html
/Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509_REVOKED_add_ext.html -> /Users/lokesh.raizada/.pyenv/versions/3.6.8/openssl/share/doc/openssl/html/man3/X509v3_get_ext_by_NID.html
/var/folders/41/4c6czpkx6c18sfcfj0lzjkd00000gq/T/python-build.20230127152902.5735 ~
~
/var/folders/41/4c6czpkx6c18sfcfj0lzjkd00000gq/T/python-build.20230127152902.5735 ~
/var/folders/41/4c6czpkx6c18sfcfj0lzjkd00000gq/T/python-build.20230127152902.5735/Python-3.6.8 /var/folders/41/4c6czpkx6c18sfcfj0lzjkd00000gq/T/python-build.20230127152902.5735
I have found this link which installs 3.6.15 with a patch. Is there any patch associated with 3.6.8 as well ?
Install python 3.6.* on Mac M1
I tried the same for 3.6.8 but no luck -
~ % pyenv86 install --patch 3.6.8 <<(curl -sSL https://raw.githubusercontent.com/pyenv/pyenv/master/plugins/python-build/share/python-build/patches/3.6.8/Python-3.6.8/0008-bpo-45405-Prevent-internal-configure-error-when-runn.patch\?full_index\=1)

Try uninstalling all python modules, python version, pyenv, XCode commandtools as well.
Do not use pyenv, as pyenv support is not available below 3.6.15 -
https://github.com/pyenv/pyenv/issues/1737#issuecomment-1423110250
Then proceed to Install 3.6.8 from - https://www.python.org/downloads/release/python-368/
https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg

Related

pyenv building python on Linux Mint with WARNING: renaming "_ctypes"

For some reason, pyenv is failing to install any versions of python due to an issue with libffi. I have all the libraries installed, yet I get:
*** WARNING: renaming "_ctypes" since importing it failed: libffi.so.8: cannot open shared object file: No such file or directory
The curious thing is libffi is installed, but it's a different version:
❯ find /usr -name '*ffi.so*'
/usr/lib/x86_64-linux-gnu/libffi.so
/usr/lib/x86_64-linux-gnu/libffi.so.7
/usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
So, the build is trying libffi.so.8 even though libffi.so.7 is installed.
Can anybody explain how debian-based systems choose the version of the shared library? I've checked the .h and .pc files, but nothing jumps out at me showing why it would be referencing version 8.
❯ ldconfig -p | grep libffi.so
libffi.so.7 (libc6,x86-64) => /lib/x86_64-linux-gnu/libffi.so.7
libffi.so.7 (libc6) => /lib/i386-linux-gnu/libffi.so.7
libffi.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libffi.so
Additional note: I notice libffi is also installed by homebrew. However, it's the same version as Mint has installed, so it's not a conflict (as far as I can tell).
Any suggestions?
❯ uname -a
Linux mcrowe-XPS-15-9560 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
❯ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=20.2
DISTRIB_CODENAME=uma
DISTRIB_DESCRIPTION="Linux Mint 20.2 Uma"
FWIW, I am seeing a similar issue. When I installed 3.9.7 with pyenv, it found libffi correctly. Today, when I install 3.9.9 I get the same error as you.
*** WARNING: renaming "_ctypes" since importing it failed: libffi.so.8: cannot open shared object file: No such file or directory
The symptom that got me looking into this was an attempt to pip install blinker which gave me an error about missing _ctypes, which was odd since 3.9.7 had no issues.
ModuleNotFoundError: No module named '_ctypes'
In my case brew had updated to libffi 3.4 vs the 3.3 that Ubuntu 20.04 is using. I figure there must be some misordering of paths where it finds the brew headers to compile, but cannot find the brew .so to link.
I would like to learn to sort that out, but in the meantime, I did the following, answering y to the pyenv prompt to reinstall over existing 3.9.9
$ brew remove --ignore-dependencies libffi
$ pyenv install 3.9.9
$ brew install libffi
That was enough of a workaround to let me return to what I wanted to deal with.

How do I update the default version of python when using Anaconda

I'm trying to start using Python 3.9 and am unable to make this happen.
From the Anaconda Prompt I run and get this:
C:\Users\fname lname>python --version
Python 3.7.10
I thought I had installed 3.9 already, so I check to see if I have it and I run this command:
C:\Users\fname lname>conda search python
Loading channels: done
# Name Version Build Channel
python 2.7.13 h1b6d89f_16 pkgs/main
python 2.7.13 h9912b81_15 pkgs/main
...
python 3.9.1 h6244533_2 pkgs/main
python 3.9.2 h6244533_0 pkgs/main
Sure enough it looks like I have 3.9.2 so I run
conda install python=3.9.2
Here I'm getting a lot of conflict errors and I'm not sure really what actually is happening if anything.
It's a pretty long list of items that pop up and most of it scrolls long enough that I can't recover all of the lines:
...
Package hdf5 conflicts for:
hdf5
opencv -> hdf5[version='>=1.10.2,<1.10.3.0a0|>=1.10.4,<1.10.5.0a0|>=1.8.20,<1.9.0a0|>=1.8.18,<1.8.19.0a0']
Package pkginfo conflicts for:
conda-build -> pkginfo
pkginfo
Package pywin32-ctypes conflicts for:
keyring -> pywin32-ctypes[version='!=0.1.0,!=0.1.1']
pywin32-ctypes
spyder -> keyring[version='>=17.0.0'] -> pywin32-ctypes[version='!=0.1.0,!=0.1.1']
And running the same version command as before I get Python 3.7.10

How to install Python 3.8 on Alpine Linux not from Python base image

Specifically in this base image https://hub.docker.com/r/frolvlad/alpine-glibc/ how does one add Python 3.8 to it.. Adding python3 installs Python3.6.9. Went through How do I install python on alpine linux? but couldn't figure it out.
Another solution, use official Python Docker image and COPY:
FROM python:3.8.13-alpine3.16 as python
COPY --from=python /usr/local/bin/python3 /usr/local/bin/python3
COPY --from=python /usr/local/lib/python3.8 /usr/local/lib/python3.8
COPY --from=python /usr/local/lib/libpython3.8.so.1.0 /usr/local/lib/libpython3.8.so.1.0
COPY --from=python /usr/local/lib/libpython3.so /usr/local/lib/libpython3.so
In the time of writing, the latest frolvlad/alpine-glibc image is based on Alpine 3.13.2. The current Python 3 version for Alpine 3.13 is 3.8.8. Therefore, for installing Python 3.8 simply install the python3 package. This is also true for Alpine 3.12 and 3.11.
If you're using frolvlad/alpine-glibc based on Alpine 3.13, 3.12 or 3.11, try updating the apk database with apk update followed by apk add python3.
On images based on older Alpine versions, such as Alpine 3.9, you'll not be able to install a functional Python 3.8, since it depends on musl 1.1.24 which is only available starting Alpine 3.10. Even though it could be installed using the Alpine 3.11+ repositories, it will fail to run due to the said musl dependency:
/ # apk add python3=3.8.2-r2 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.11/main
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
(1/10) Installing libbz2 (1.0.8-r1)
(2/10) Installing expat (2.2.9-r1)
(3/10) Installing libffi (3.2.1-r6)
(4/10) Installing gdbm (1.13-r1)
(5/10) Installing xz-libs (5.2.4-r0)
(6/10) Installing ncurses-terminfo-base (6.1_p20200118-r4)
(7/10) Installing ncurses-libs (6.1_p20200118-r4)
(8/10) Installing readline (8.0.1-r0)
(9/10) Installing sqlite-libs (3.30.1-r2)
(10/10) Installing python3 (3.8.2-r2)
Executing busybox-1.29.3-r10.trigger
Executing glibc-bin-2.29-r0.trigger
OK: 71 MiB in 27 packages
/ # python3 --version
Error relocating /usr/lib/libpython3.8.so.1.0: copy_file_range: symbol not found

Installing hyperledger indy node code fails on python3 not being default on Mac

I am installing Hyperledger Indy (sovrin) self-identity software per these instructions.
I have Python2.7 installed via Anaconda 3. I also have Python3.6.3 installed that I downloaded and installed from here.
I'm trying to install some other software that has a dependency for Python > 3.5.
I've tried several methods to change my default Python:
Per this SO I set it manual in current terminal window:
alias python='python3'
Per same SO I vi .bash_profile and added:
alias python='python3'
then source ~/.bash_profile
Set a link to Python3:
bc-computer:~ momi$ unlink /usr/local/bin/python2
bc-computer:~ momi$ ln -s /usr/local/bin/python3 /usr/local/bin/python
but still continue to get the same error:
bc-computer:~ momi$ pip install indy-node-dev
Collecting indy-node-dev
Using cached indy-node-dev-1.2.227.tar.gz
Complete output from command python setup.py egg_info:
FAIL: Requires Python 3.5 or later, but setup.py was run using 2.7.14
NOTE: Installation failed. Run setup.py using python3
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3f/sh6dr8wx6w720b1_w38f_fh00000gq/T/pip-build-ecZnYY/indy-node-dev/
I also tried setting up a python3 test environment per this:
python3 setup.py test
And got this error:
> /usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python:
> can't open file 'setup.py': [Errno 2] No such file or directory
Please note that I tried this suggestion which seems to be the non-duplicate answer but didn't work for me:
The safest way is to set an alias in ~/.bashrc:
alias python=python3
My environment:
uname -msra
Darwin bc-computer.local 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64
My OS:
High Sierra 10.13.1
which -a python
/Users/momi/anaconda2/bin/python
/usr/local/bin/python
/usr/bin/python
Thank you
Ok the solution was to use pip3 rather than pip for my install command per Mike Mueller's answer here:
pip3 install indy-node-dev
I assume that pip3 points to python3x rather than 2x.
I have also installed Hyperledger Indy SSI VC using MacOs Python 3.6.3. It is working for for me. I could demo the VON Network. It seems that your machine environment still points to Python 2.7. There are different ways by which we can point to Python 3.6.3 through virtual environment. You can try those options.

downloading matplotlib python 2.7.1 windows 8

I want to use pyPlot, therefore install matplotlib.
When I downloaded numpy, I realized I already have pip on this python version (I have windows 8, using 64-bit)..
Now if I want to install matplotlib to my python, can I do it using some kind of command from the command line or do I need to install something first and then navigate to setup.py Directory and run:
python setup.py
when I try:
pip install matplotlib
or even installing it and using
pip install matplotlib-1.5.0-cp35-none-win_amd64.whl
it gives me error:
ValueError: failed to parse CPython sys.version: 2.7.9 |CUSTOM| (default,
Jul1 2015 03:41:50 ) [ MSC vs. 1500 64 bit (AMD 64)]
location of my python is:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 2.7
ANY HELP..?
Why not installing it with pip then?
pip install matplotlib
You either install it with pip: pip install matplotlib or download the binary from windows.

Categories

Resources