I've had a look around, and cannot find an answer to my problem.
All I try to run is
pip3 install -r requirements.txt
but in just about everything I run, I get "invalid syntax" or
Traceback (most recent call last): File "", line 1, in
NameError: name 'python' is not defined
All I am trying to do is install a set of packages from a text file in a folder on my desktop.
This is stressing me, as nothing seems to work.
Id appreciate any help!
Did you by any chance type python in before running that?, if you did then it's throwing that traceback call because it thinks python is a variable, not a command
Also, did you already try installing the package directly from the source?
Most can be run as pip3.x install package where package is the name of what you want to install (e.g Pygame).
I would open a new command shell, terminate processes on current, and run
python -v to know the exact version you have installed. Then pip2.x or pip3.x (where x is version of 2 or 3) install package directly online.
Related
I'm following this guide to install GUDHI for python. I ran the following commands
cd /path-to-gudhi/
mkdir build
cd build/
cmake ..
cd python
make
After that, the guide says to do
cd /path-to-gudhi/build/python
# May require sudo or administrator privileges
make install
But when I run the make install nothing happens, it only returns
Install the project...
-- Install configuration: ""
And I don't really know if I'm doing something wrong (it's my first time installing a python module). When in python I type
import gudhi
it returns
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'gudhi'
Also when I do
make test
on the command line, it returns
Running tests...
Test project /home/alex/gudhi.3.0.0/build/python
No tests were found!!!
What could have gone wrong?
Installing all the dependencies and make it compile can be complicated.
Would the gudhi conda package fill your need ? You would just need to install Miniconda first (in Python 3.X).
And more recently, a gudhi pip package is also available.
This question already has answers here:
Why does "pip install" inside Python raise a SyntaxError?
(7 answers)
Closed 3 years ago.
when i type:
import numpy as np
i get this error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
i tried to install like :
pip3 install numpy
but this error comes up on the word 'install':
SyntaxError: invalid syntax
i'm working on python 3.7.4 on windows8 32bits
i know it might be trivia but i'm just starting with python
Did you install pip first? If not, follow this:
Download get-pip.py to a folder on your computer.
Open a command prompt and navigate to the folder containing get-pip.py.
Run the following command:
python get-pip.py
You can verify that Pip was installed correctly by opening a command prompt and entering the following command:
pip -V
You should see output similar to the following:
pip 18.0 from c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)
Go to the folder that your pip is located and run your command:
cd c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip
pip install numpy
you should first quit the command line of python and then type pip install numpy in the cmd
First, check are you outside the command line, if yes then
Try
python -m pip install --upgrade pip
then
python -m pip install numpy
If it did not work, try adding python and pip full path in the commands.
One simple way of doing this is by using PyCharm, which can be downloaded for free.
Simply open your project in it, or create a temporary one, go to settings, project settings, and then to project interpreter. Here you can add your current python interpreter or create a new one, and then just press the add button to add libraries into that interpreter.
Now when you use that interpreter in or out of PyCharm, you will have access to any of those libraries you added.
This is not the best way of doing this, however, it is a sure way of making it work, and PyCharm is a great IDE for Python.
getting some errors when trying to run spyder (3.2.4) and I am thinking it is because of its install location.
On ubuntu-17.10, using python 3.6.3, I wanted a pip installed version of spyder and using pip3 install --user spyder which went with all the other packages in ~/.local/lib/python3.6/site-packages and sent the executable to ~/.local/bin.
Running the spyder3 executable returns a long list of errors and permission denials.
I have tried installing it by sudo pip3 install -U spyder which goes to /usr/local/bin/ but nothing changes. Also I want the installation in my home folder with the other packages. What have I done wrong? Is this an incorrect way to use spyder?
$ ~/.local/bin/spyder3
Failed to write user configuration file.
Please submit a bug report.
Traceback (most recent call last):
File "/home/stelios/.local/lib/python3.6/site-packages/spyder/utils/external/lockfile.py", line 150, in lock
symlink(str(os.getpid()), self.name)
FileExistsError: [Errno 17] File exists: '9449' -> '/home/stelios/.config/spyder-py3/spyder.lock'
This was only part of the full error message but it was quite long and I didn't want to clutter the quesion. If you need to see it in full please let me know and I will post it.
I am trying to install EasyGui on Python 3.3 and I don't see to have it. I had gotten it to work with Python 2.7 but not for 3.3.
I follow the instructions from their website:
Unpack the archive file into a temporary directory
Open a console window and navigate to the temporary directory.
At the command prompt, enter the command:
python setup.py install
But I keep getting this error when I use the command 'import easygui':
Traceback (most recent call last):
File "/pyshell#0/", line 1, in
import easygui
ImportError: No module named 'easygui'
For Python 3 you need to call python3 when installing it, so instead of
python setup.py install
you must do
python3 setup.py install
Just add "easygui.py" to your site-packages directory. It will work with any editor. I am using Coderunner, and I had the same problem. It took me an hour to figure it out :)
easy. type pip3 uninstall easygui then pip3 install --user easygui
I am trying to install Twitter-Python and I am just not getting it. According to everything I've read this should be easy. I have read all that stuff about easy_install, python setup.py install, command lines, etc, but I just don't get it. I downloaded the "twitter-1.9.4.tar.gz", so I now have the 'twitter-1.9.4' folder in my root 'C:\Python27' and tried running
>>> python setup.py install
in IDLE... and that's not working. I was able to install a module for yahoo finance and all I had to do was put the code in my 'C:\Python27\Lib' folder.
How are these different and is there a REALLY BASIC step-by-step for installing packages?
1) Run CMD as administrator
2) Type this:
set path=%path%;C:\Python27\
3) Download python-twitter, if you haven't already did, this is the link I recommend:
https://code.google.com/p/python-twitter/
4) Download PeaZip in order to extract it:
http://peazip.org/
5) Install PeaZip, go to where you have downloaded python-twitter, right click, extract it with PeaZip.
6) Copy the link to the python-twitter folder after extraction, which should be something like this:
C:\Users\KiDo\Downloads\python-twitter-1.1.tar\dist\python-twitter-1.1
7) Go back to CMD, and type:
cd python-twitter location, or something like this:
cd C:\Users\KiDo\Downloads\python-twitter-1.1.tar\dist\python-twitter-1.1
8) Now type this in CMD:
python setup.py install
And it should work fine, to confirm it open IDLE, and type:
import twitter
Now you MAY get another error, like this:
>>> import twitter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\twitter.py", line 37, in <module>
import requests
ImportError: No module named requests
Then you have to do kinda same steps in order to download the module requests.
Looking at the directory structure you have, I am assuming that you are using Windows. So my recommendation is to use a package manager system such as pip. pip allows you to install python packages very easily.
You can install pip here:
pip for python
Or if you want the windows specific version, there are some pre built windows binaries here:
pip for windows
Doing python setup.py install in IDLE will not work because that is an interactive python interpreter. You would want to call python from the command line to install.
with pip, you can go to the command line and run something like this:
"pip install twitter-python"
Not all python packages are found with pip but you can search using
"pip search twitter-python"
The nature of pip is that you have to type out the exact name of the module that you want.
So in a nutshell, my personal recommendation to get python packages installed is:
Install pip executable
Go to the command line
Type "pip search python_package"
Find the package you want from the list.
Type "pip install python_package"
This should install everything without a hitch.
Installing Python Modules clearly states you need to install the packages from command line, not the Python interpreter IDE (like IDLE):
For Windows, this command should be run from a command prompt window
(Start ‣ Accessories):
setup.py install
You mention the python setup.py install command, which intends calling python interpreter already and wouldn't make sense to run within interpreter.
You need to set the Windows system path variables to include c:\Python27 and C:\Python27\Scripts.
You do not need to set PYTHONPATH nor use any bat files.
Path c:\Python27 will tell Windows where python.exe is
Path c:\Python27\Scripts will tell Windows where pip is
Run pip from Windows command line (do not use Idle)
Basically, with python3.4.3, you just have to do two things to be able to use twitter:
1.python -m pip install -U pip
then once pip is updated (as it comes preinstalled). you do the second step:
2. pip install twitter
this will install twitter package.
Today, after using pre method, I could not use it again (as per my post yesterday). So I tried another way that's simple and cool and hope would work always (on my pc at least):
...Python34>cd scripts #command prompt change die where pip is
...Python34\Scripts>pip install fabric #in this dir, use pip
Awesome (for me at least) although the package I wanted could not be 'perfectly' installed, yet another pythovery.