I am trying to run a script from a repo which was using python 3.7 and other packages version that were not supported in M1.
I install a separate conda through open terminal under Rosetta, i can install those specific packages i need. but when i try to run some sample scripts (repo comes with some pytest example) i always got error of Python Segmentation Fault.
Any clue/direction on how to solve this, or this is not solvable.
Or any detail might be helpful to understand the situation.
Thanks.
I don't know if it's solvable, but I think I'm running into the same issue.
For reasons (ortools package not supporting M1) I need to run Python under Rosetta 2, the following used to work, but now segfaults:
# Install Homebrew with Rosetta 2 / Intel
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# Install Python 3.8 using 'Intel' Homebrew
arch -x86_64 /usr/local/bin/brew install python#3.8
Then in my project directory, I setup a venv:
arch -x86_64 /usr/local/bin/python3.8 -m venv venv
. ./venv/bin/activate
# Install requirements (including pytest)
arch -x86_64 pip install -r requirements-dev.txt
Then I get a segfault, regardless of if I run pytest under Rosetta or not:
(venv) me#host myproject % pytest
zsh: segmentation fault pytest
(venv) me#host myproject % arch -x86_64 pytest test/unit_tests
zsh: segmentation fault arch -x86_64 pytest test/unit_tests
Related
On Mac OS.
Downloaded the Python from their website.
Python -V return Python 2.7.16, and
python3 -V return Python 3.9.4
Installed pip with : python3 get-pip.py, got Successfully installed pip-21.0.1
But when I run pip -V
I get File "/usr/local/bin/pip", line 1.... SyntaxError: invalid syntax
After reading here a lot, i could not understand (in simple words for dumbs) :
How could you "alias" or update python to show/run in version 3+ ?
Why I can't get the pip version if it's installed ?
Use pip as a module instead
% python3 -m pip --version
pip 21.0.1 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
Anyone who's interested , what i had to do is to
CD the project on terminal
run python3 -m venv env (this create virtual environment of python3 inside project)
run source env/bin/activate activate it.
now pip --version or python --version will return the right results.
From my basic knowledge i understand that the mac is using python2 which we don't want to interrupt, so we install python3 and create a 'virtual environment' for it inside our project folder, once its in, we can install all other things.
to deactivate (stop the virtual env) we run deactivate
I recently switched from bash to zsh (MacOS). I haven't used pipenv since the switch. Now when I run any pipenv command I get the following error:
$ pipenv install
zsh: /usr/local/bin/pipenv: bad interpreter: /usr/local/opt/python/bin/python3.7: no such file or directory
I use pyenv for Python dependency management:
$ which python
/Users/ryan.payne/.pyenv/shims/python
My default python version is 3.7.3:
$ pyenv versions
system
2.7.16
3.6.8
* 3.7.3 (set by /Users/ryan.payne/.pyenv/version)
It seems like pipenv is not using my pyenv version of Python. How do I get pipenv working again?
You don't need to uninstall anything. Simply change the interpreter at /usr/local/bin and have your current python path in pyenv handy:
type python3
copy the path
vi /usr/local/bin/pipenv
It will look something like this:
Once it's changed, you will probably have to download pipenv again. Don't worry, your env is fine.
pip install pipenv
Go play in your env
I had this same error with awscli. The solution was to install python#3.7 via homebrew and then cp that installation into the directory awscli expected.
brew install python#3.7
cp -r /usr/local/opt/python#3.7/bin/python3.7 /usr/local/opt/python/bin/python3.7
Run in terminal:
brew install python3 && cp /usr/local/bin/python3 /usr/local/bin/python
After brew installation, sometimes it may not work.
Depending on whether you tried to install other python versions, the links might not be working any more, and therefore running the command
brew install python3 && cp /usr/local/bin/python3 /usr/local/bin/python
Might give an error as below
Error: Could not symlink bin/2to3
Target /usr/local/bin/2to3
already exists.
Try to remove the file 2to3
rm '/usr/local/bin/2to3'
and run the above code again
Alternatively, you can force the linkage
brew link --overwrite python#<version>
but you can first see the files that will be deleted by this forced linking using the command
brew link --overwrite --dry-run python#<version>
I hope this gives more light
If you installed pipenv with pipenv with pipx, then you can reinstall pipenv via pipx reinstall pipenv which should detect any top level changes in your python environment.
I have fresh ubuntu 16.04 setup for production.
Initially if when i type
python --version gives me python 2.7 and python3 --version gives me python 3.5
but i want python points to python3 by default, so in my ~/.bashrc
alias python=python3 and source ~/.bashrc,
After that i install pip using sudo apt-get install python-pip and when i type pip --version it prints pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7) instead that i want packages to be installed into and get from /usr/local/lib/python3.5/dist-packages.
I have django application which is written with python3 compatible code.
Update: I want to install other packages which have to load from python3 dist-packages not just pip. I don't want to remove python 2.7 from ubuntu it will break other programs, i thought alias python=python3 would install packages into python3.5 dist-packages as well.
You need to use pip3 as the command.
pip3 install coolModule
Be sure to add to your bash profile.
alias pip3="python3 -m pip"
I am new to linux and try to install tensorflow on cygwin on a windows 7 machine with only CPU following this instruction.
I tried to install with native pip however encountered some errors when running this command:
pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.2.1-cp36-cp36m-linux_x86_64.whl
(I omitted sudo since there's no sudo on my cygwin). The error message is:
tensorflow-1.2.1-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.
The python 3 on my cygwin is 3.6.1, pip3 version is 9.0.1.
Here are some basic command result:
$ python3 -V
Python 3.6.1
$ whereis python3
python3: /usr/bin/python3 /usr/bin/python3.6 /usr/lib/python3.6 /usr/include/python3.6m /usr/share/man/man1/python3.1.gz
$ pip3 -V
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)
$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/ActiveState Komodo Edit 10:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/Microsoft Application Virtualization Client:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/Pandoc:/cygdrive/c/Program Files/MiKTeX 2.9/miktex/bin/x64:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/PuTTY:/cygdrive/c/Program Files (x86)/Skype/Phone:/cygdrive/c/Program Files/1E/NomadBranch:/cygdrive/c/Users/jinhuwang/AppData/Local/rodeo/app-2.5.2/bin
I've seem many related question on stackoverflow but got no luck to find the solution to mine. Could anyone help?
From cygwin's frontpage:
Cygwin is not:
a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.
I recently downloaded Ubuntu 14.04 desktop version alongside Windows 10.
My PC configs are: 4 GB RAM, 64 bit
I installed Anaconda after downloading the file using:
bash Anaconda3-2.5.0-Linux-x86_64.sh
Installation was successful.
Now in my ubuntu terminal, I follwed steps as instructed on http://xgboost.readthedocs.org/en/latest/build.html#building-on-ubuntu-debian
Installed a recent GNU C++ compiler -->successful
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; make -j4
Building was also successful and I could build 'libxgboost.so'
sudo apt-get install python-setuptools (Successful)
cd python-package
sudo python setup.py install
The 5. command returns an error after a lot of lines:
'ImportError: No module named numpy.distutils.core'
Can anyone suggest how to get rid of this error so that I can install xgboost ?
I had the same problem today. I believe the issue is the instructions you listed are out of date for Python installs, as they are now enabled with pip install.
Delete the xgboost directory that your above install attempt created, and then execute:
pip install xgboost
It should all work with one command. See also the Python Specific XGBoost Install Instructions.
This issue is listed in xgboost's github
The solution is
sudo -s
python setup.py install
instead of
cd python-package; sudo python setup.py install