I'm on a Mac OSX (Catalina) trying to install the AWS Elastic Beanstalk CLI.
>>>python --version
Python 2.7.16
>>>which python
/usr/bin/python
>>>python3 --version
Python 3.7.5
>>>which python3
/usr/local/bin/python3
What I've tried
Using Brew
>>>brew uninstall awsebcli
>>>brew install awsebcli
>>>eb --version
-bash: /Users/<user>/.local/bin/eb: /Users/<user>/projects/hello-world-flask/venv/bin/python3: bad interpreter: No such file or directory
Now the funny thing is that hello-world-flask is just a toy example I have in one of my directories, but I have no idea why the EB CLI is trying to use that venv, or why it says that it doesn't exist.
>>>ls /Users/<user>/projects/hello-world-flask/venv/bin/python3
/Users/<user>/projects/hello-world-flask/venv/bin/python3
Using Pip3
>>>brew uninstall awsebcli
>>>pip3 install awsebcli
...
Successfully installed awsebcli-3.16.0
>>>eb --version
-bash: /Users/<user>/.local/bin/eb: /Users/<user>/projects/hello-world-flask/venv/bin/python3: bad interpreter: No such file or directory
The Question
I'm assuming the EB CLI is just supposed to execute Python 3.x. How do I fix this and make the EB CLI use the correct version of Python?
I realize this answer is a bit late and ran into a similar issue myself. According to this you might have better luck being explicit about your python executable and using the --python-installation flag. Try something like
python scripts/ebcli_installer.py --python-installation /path/to/some/python/on/your/computer
or to be extra explicit
/path/to/your/exact/python scripts/ebcli_installer.py --python-installation /path/to/some/python/on/your/computer
This is part of the "Advanced Use" section on the EB CLI github
I couldn't figure this out. I keep encountering error env: python: No such file or directory. So I just defaulted to installing it via brew https://formulae.brew.sh/formula/aws-elasticbeanstalk#default
Related
Initially, I had installed Apache Airflow and python 2.7 is set as default path. Now, I'm trying to change path from 2.7 to 3. Is it possible to do so or do I have re-install the airflow and set the python path? Any pointers would be helpful?
Thanks in advance!
There are a few ways to make sure that you are using the version of Python that you would like. Docker is one, take a look at https://github.com/puckel/docker-airflow for a good example.
Another is to use virtual environments. I've only used Virtualenv with success. I like Pipenv, but unfortunately I ran into some dependency-trouble using it with Airflow.
Anyways, here is an example of what should work with Virtualenv:
cd your-project
virtualenv -p python3 .direnv
source .direnv/bin/activate
pip install -r requirements.txt
python --version should list python 3, and running airflow webserver, should run Airflow in python 3.
I had installed Apache Airflow and python 2.7 is set as default path.
Use
pip3 install apache-airflow
instead of
pip install apache-airflow
I'm new to Python and Linux and want to install a MATLAB Engine for Python 3.6. I already followed the steps from Mathworks (http://www.mathworks.com/help/matlab/matlab-engine-for-python.html)
and tried also to use python setup.py build --build-base=$(mktemp -d) install but the error still appears. I have MATLAB R2018a installed and use Spyder 3.2.8 with Anaconda.
Does someone has an advice?
Thanks in advance!
If you're trying to install matlab engine in a conda environment, follow the below steps:
cd "matlabroot\extern\engines\python"
python setup.py install --prefix="installdir"
Eg
cd /opt/MATLAB/R2019a/extern/engines/python
python setup.py install --prefix="/home/nagabhushan/anaconda3/"
Now, matlab engine package is actually installed under the separate
anaconda3/lib/python3.6/site-package/matlab
So you need to manually move that matlab folder to the site-package folder your python is using. If you have multiple virtual envs, move it to the corresponding site-package folder of the virtual env you will run program.
Eg
anaconda3/envs/my_env/lob/python3.6/site-packages/matlab
References:
https://stackoverflow.com/a/41800724/3337089
https://stackoverflow.com/a/56553740/3337089
Edit 1 (03-Mar-2020):
I tried activating my environment and then simply installing matlab engine and it worked! I'm using Python 3.7
python setup.py install
Note that this initially gave error that error: You do not have write permission in build/lib/matlab/engine/, but changing the permission of build directory recursively worked: sudo chmod -R 777 build/
Following Nagabhushan S N answer,here, in order to install matlab/matlab.engine with conda (miniconda3) with Linux Ubuntu 18 LTS and Matlab 2018, I performed the following steps.
I have created a new conda enviroment (python36) with Python 3.6 interpreter, Python 3.6 is one of the supported version by Matlab 2018 (and you need to match the right Pyhton version or it'll install Python 2.7 libs), and I have directly installed the libs in the python36 env subfolder, in detail:
cd /usr/local/MATLAB/R2018a/extern/engines/python
python setup.py install --prefix="/home/myname/miniconda3/envs/python36"
e.g., import matlab.engine is now usable from the python36 environment.
P.s: the installation needs write access to the build subfolder (under usr/local...), so you need to go sudo and chmod -R +777 /usr/local/MATLAB/R2018a/extern/engines/python/build
P.s.2: by installing only in a base env, in my case, does not provide matlab.engine to work with the other conda envs too.. perhaps this is a normal, expected, conda behaviour.
After many tests I think I solved the problem. I will post the answer if someone has the same problems. As mentioned here:
https://stackoverflow.com/a/39759581/9834571
You can add an alternative python command. For me it worked when I vary the mentioned example as followed:
sudo update-alternatives --install /usr/bin/python python ~/anaconda3/envs/ 2
update-alternatives --display python
cd /usr/local/MATLAB/R2018a/extern/engines/python/
python setup.py build --build-base=$(mktemp -d) install
I'm having an issue with my awscli version + python versions installed on my Mac.
After several tries following this I managed to have it working, however, if i run aws --version I get aws-cli/1.11.170 Python/2.7.10 Darwin/16.7.0 botocore/1.7.28
This confused me because I thought I had just installed python 3.6, so I decided to run which python, and it returned /usr/bin/python
I was still unsure and after some research I found this:
$which python3 /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
Now i'm totally unsure which python version is the "main" one and if it is affecting my awscli, i plan to create a restapi using aws SDK with boto3 for Python.
How can i clean my python install or simply make sure my Mac is ready to work with the aws SDK + python?
PS.: I've tried this to uninstall python 2.6, 2.7 and 3.6 (currently installed on my system i suppose) but nothing really happened.
Thanks in advance for the help!
I would recommend creating a virtual environment to create an isolated environment for all the packages in your project. You can create a virtual environment of a specific python version using the following syntax in your shell:
$ python3.6 -m venv env
One you activate the virtual environment, you can use pip to install packages into your local python instance:
$ source env/bin/activate
(env) $ pip install awscli
Whenever you plan to run your application, or install packages for the project, simply activate the virtual environment.
For more information, see the documentation for the venv module in Python's standard library.
Using Git Bash on Windows 10.
python version: 2.7.12
When run pip, it shows:
$ pip
bash: /c/cygwin/bin/pip: /usr/bin/python2.7: bad interpreter: No such file or directory
How to find the right python path with pip?
Addition
$ which python
/c/cygwin/bin/python
Your pip is somehow using the wrong path for your python that doesn't exist. However, there is a simple workaround, you can type this to specify the python interpreter you want to use:
$ /c/cygwin/bin/python -m pip install yourpackage
This is only a temporary workaround, to fix it, try something from this question.
I installed Fabric via Pip, which was installed via Homebrew (OS X 10.6.6). The Fabric library is where pip says it should be, however I cannot get a basic fabfile going.
I've tried the simple hello world example found here: http://docs.fabfile.org/en/1.0.1/tutorial.html
Bash gives me the following error when I try fab hello:
-bash: fab: command not found
Paths:
Python 2.7.1: /usr/local/bin/python
pip libraries: /usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages
I'm probably overlooking something silly. Thanks for the help.
When you install Fabric with Homebrew and Pip, fab gets put at /usr/local/Cellar/python/2.7.1/bin/fab. Make sure /usr/local/Cellar/python/2.7.1/bin is on your PATH.