Getting Fabric Python Library to Work - python

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.

Related

AWS Elastic Beanstalk CLI Using Wrong Python Version

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

Very Basic Python 2.7.13 Trouble opening files in IDLE and python

took a break from programming and am trying to get an old program up and running. I previously wrote a program called 'NetsimGUI' that uses modules networkx and matplotlib. I could not figure out how to install them on a new computer (running Windows 10) and then realized I could barely do anything at all. In the Python command window after importing pip I have tried the following:
'python pip install networkx'
'pip install networkx'
'python NetsimGUI'
'python NetsimGUI.py'
'Python NetsimGUI.py'
'Python27 NetsimGUI.py'
'NetsimGUI.py'
'NetsimGUI'
'python -m pip install -U pip'
'python -v'
'py27 -v'
'py -27 -v'
'Python -v'
and so on. All give errors saying NameError: name 'python' or name 'py' is not defined or something similar. PATH environment variable is set to C:\Python27 and NetsimGUI.py is in that folder as well. Guessing the solution is something super simple I am missing. Any ideas?
It looks like you're basically having trouble installing pip on Windows. What you're doing isn't exactly correct, the correctly way to install pip 2.7 on Windows is detailed here
From the docs:
To install pip, securely download get-pip.py.
Then run the following:
python get-pip.py
Once you've done that, you should be able to install python modules as normal.

Installing PIP on Windows 10 python 3.5

I just started learning Python, and successfully downloaded Python 3.5. I attempted to download/upgrade PIP 8.1.2 multiple times using get-pip.py, which I ran (successfully I think) but when I attempted to execute python get-pip.py
I got the error code:
File "<stdin>", line 1
python get-pip.py
^
SyntaxError: invalid syntax
I understand that pip is included in python but the pip website requires users to upgrade pip which I don't think I can since any pip commands lead to syntax errors, and do not produce the same output that most tutorial sites show. I have tried to find different ways to fix it, but I can't figure out whats wrong aside from pip not being on the computer in the first place or corrupted. Thank you for your assistance.
You won't need to upgrade pip if you just downloaded python 3.5, go to where you have your Python3.5 file and open the folder Scripts, you will find pip.exe. Open powershell and use the cd command to move to the folder containing pip.exe. From here you can use pip install to get modules.
Open Windows Powershell
PS C:Users\you> cd C:\path\to\scripts\folder\containing\pip
PS C:\path\to\scripts\folder\containing\pip> pip install module
Not sure what you are asking. If you want to run python get-pip.py do it in a windows command prompt, not in the python interpreter. But I do not know why you would want to do that.
You already have pip; there is no need to run get-pip. Upgrading can be done by pip itself.
But the reason you are getting errors is that all these commands, including pip itself, should be run at the command line, not in the Python interpreter.

How to use pip with multiple instances of python

I recently installed python3 only to realize that mysql-python as well as many other modules were not well supported with it yet. So I changed the path in my bashrc file to point to an installation of python 2.7. The problem is that when I installed python 3 I also installed distribute and pip along with it. I removed the pip and distribute files from the python3 bin directory and installed setuptools and pip using python 2.7 however now when I use the pip command to install django and mysql-python, I get a bash error python331/bin/pip No such file or directory. It's still looking for pip in the python3 install. How can I remedy this?
Thanks
...I get a bash error python331/bin/pip No such file or directory.
It's still looking for pip in the python3 install. How can I remedy
this?
bash, by default, hashes the locations of commands to avoid searching $PATH each time, so if, when you execute...
$ type pip
...you get something like...
pip is hashed (python331/bin/pip)
...you just need to clear the hash table for bash with...
$ hash -r
...then it'll pick up the version in Python 2.7 the next time you try to run pip.
Fixed it.
Renamed the directory of where the python3 was installed, bash automatically looks for the next available python install python 2.7

beginner installing nosetests package

I'm trying to install the following as per the learnpythonthehardway tutorial:
pip from http://pypi.python.org/pypi/pip
distribute from http://pypi.python.org/pypi/distribute
nose from http://pypi.python.org/pypi/nose/
virtualenv from http://pypi.python.org/pypi/virtualenv
I've visited these links and clicked the download button; each file is in my downloads folder now, and I unarchive/unzipped them- not sure what this means but it seemed required. Are they "installed"? If not, what does it mean to really install them? I've tried typing nosetests in the terminal (as the book says you should), as well as tried easy_install but that doesn't seem to work. It appears my understanding is limited in a number of ways here.
I get the following -bash: nosetests: command not found, but am trying to get:
nosetests . ---------------------------------------------------------------------- Ran 1 test in 0.007s
OK
This works on mac, it may work on linux
1)Open terminal (Be prepared to enter your password)
2)Type: sudo easy_install pip
3)Type: sudo pip install distribute
4)Type: sudo pip install nose
5)Type: sudo pip install virtualenv
Hope that helps, cheers!
They are not yet installed.
Each has its own vagaries about how exactly the install process works and in fact some of those packages will include the other packages with them. I.e.
"If you use virtualenv, a copy of pip will be automatically be
installed in each virtual environment you create."
http://pypi.python.org/pypi/pip
As a relatively new python user myself, (and having gone thru a similar process not long ago) I am eagerly awaiting the more complete answers that come back for this one.
Find out where the nosetests script is. On OSX:
/usr/local/share/nosetests
Execute directly, or set up a bash alias, perhaps in .bash_profile:
alias nosetests='/usr/local/share/python/nosetests'
alias nosetests3='/usr/local/share/python3/nosetests'
You were on the right track, but the package is actually called "nose". The documentation for nose (nosetests is the script) can be found here:
https://nose.readthedocs.org/en/latest/
The short answer is that you have 2 basic options: easy_install or pip. Install using setuptools/distribute: easy_install nose. Install using pip: pip install nose
Install Python 2.7 and after just do this (only on Windows - Windows PowerShell):
Setup PATH env:
C:\Python27\;C:\Python27\Scripts\", "User"
pip is already installed
3.
.\pip install distribute
4.
.\pip install nose
5.
.\pip install virtualenv

Categories

Resources