I'm learning python right now. I installed Pip and everything seemed correct in the instalation but when I executed any command from Pip such as pip install (path) it gave errors such as:
Traceback (most recent call last):
File "", line 1, in
or
SyntaxError: invalid syntax
Can anyone help me please?
For other people running into this problem all i did was
pkg update than pkg install clang this is for Linux and Termux.
For windows it will be npm update than npm install clang
incase you use yarn than yarn update than yarn add clang
in terminal use python -m pip install 'packagename'
in python shell try
import pip
pip.main(['install','packagename'])
replace packagename with the package you want to install
or download the module and use python setup.py packagename
( How to manually install a pypi module without pip/easy_install? )
Related
I am trying to install something using "python setup.py install" but it shows me this error :-
Traceback (most recent call last):
File "setup.py", line 3, in <module>
from setuptools import setup
ImportError: No module named setuptools
I have installed this missing module using "pip install setuptools". But still it shows me the same error .I have also tried to install this using "sudo apt-get install python-setuptools" but the problem still remains the same. Help me in this issue
If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from python.org, you will already have pip and setuptools, but will need to upgrade to the latest version:
On Linux or macOS:
pip install -U pip setuptools
On Windows:
python -m pip install -U pip setuptools
If you’re using a Python install on Linux that’s managed by the system package manager (e.g “yum”, “apt-get” etc…), and you want to use the system package manager to install or upgrade pip, then see link
I need help installing pydasm into python 2.7. The readme.txt file tells me that I have to enter python setup.py build_ext into the cli. When I do, I get the error:
Traceback (most recent call last):
File "setup.py", line 22, in <module>
raise DistutilsPlatformError()
distutils.errors.DistutilsPlatformError
If you can help, please let me know!
Since no one answered my question, I thought I would so if other people have the same issue they can look here for help.
I went to this site: http://ademata.blogspot.com/2010/07/installing-pydasm-and-pefile-module-on.html
Follow these instructions:
Pydasm is included with the module libdasm. An open source fork is available at http://libdasm.googlecode.com/svn/trunk/ svn/libdasm-read-only and requires the use of the subversion tool. To install subversion use sudo apt-get install subversion.
Run the following command to download the latest libdasm code:
svn checkout http://libdasm.googlecode.com/svn/trunk/ svn/libdasm-read-only
Run the following series of commands to install the module on python:
cd svn/libdasm-read-only/
make
sudo make install
cd pydasm
sudo apt-get install python2.6-dev
(use the most recent, so for me I did 2.7)
python setup.py build_ext
sudo python setup.py install
Pefile is included in Ubuntu's repository, to install the pefile module run sudo apt-get install python-pefile.
Hope this helped.
I know this is a very dumb question, but I can't install CherryPy. In the documentation is written:
To install, change to the directory where setup.py is located and type (python-2.3 or later needed):
python setup.py install
Which is what I do, I type this in Python Shell and it gives me error Invalid syntax, but I don't think I have any syntax errors.
You won't install programs in the Python shell. Navigate to where you downloaded the source and run python setup.py install.
Alternatively, you can use pip:
pip install cherrypy
The best installation for Cherrypy, Mako, Python with terminal in Ubuntu is:
sudo apt-get install subversion python-mako python-simplejson python-cherrypy3 graphviz
And after sudo apt-get update and after sudo apt-get upgrade
"I type this in Python Shell"...
Don't type that in the Python shell.
>>> python setup.py install
File "<stdin>", line 1
python setup.py install
^
SyntaxError: invalid syntax
Type it at the commandline.
$ python setup.py install
Or if you're on Windows:
C:\>python setup.py install
I have found out the steps to install via command prompt, please fer to the attachment below. For me "python setup.py install" does not work but it works find for "setup.py install" after I pointed it properly to the directory>
Hope my experiment helps:
Step1
Step2
If you are installing on Mac and say you are using python 3, you would want to use:
sudo python3.3 setup.py build
Then after build is finished.
sudo python3.3 setup.py install
I'm having a strange problem while trying to install the Python library zenlib, using its setup.py file. When I run the setup.py file, I get an import error, saying
ImportError: No module named Cython.Distutils`
but I do have such a module, and I can import it on the python command line without any trouble. Why might I be getting this import error?
I think that the problem may have to do with the fact that I am using Enthought Python Distribution, which I installed right beforehand, rather than using the Python 2.7 that came with Ubuntu 12.04.
More background:
Here's exactly what I get when trying to run setup.py:
enwe101#enwe101-PCL:~/zenlib/src$ sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 4, in <module>
from Cython.Distutils import build_ext
ImportError: No module named Cython.Distutils
But it works from the command line:
>>> from Cython.Distutils import build_ext
>>>
>>> from fake.package import noexist
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named fake.package
Note the first import worked and the second throws an error. Compare this to the first few lines of setup.py:
#from distutils.core import setup
from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import os.path
I made sure that the Enthought Python Distribution and not the python that came with Ubuntu is what is run by default by prepending my bash $PATH environment variable by editing ~/.bashrc, adding this as the last line:
export PATH=/usr/local/epd/bin:$PATH
and indeed which python spits out /usr/local/epd/bin/python... not knowing what else to try, I went into my site packages directory, (/usr/local/epd/lib/python2.7/site-packages) and give full permissions (r,w,x) to Cython, Distutils, build_ext.py, and the __init__.py files. Probably silly to try, and it changed nothing.
Can't think of what to try next!? Any ideas?
Install Cython:
pip install cython
Your sudo is not getting the right python. This is a known behaviour of sudo in Ubuntu. See this question for more info. You need to make sure that sudo calls the right python, either by using the full path:
sudo /usr/local/epd/bin/python setup.py install
or by doing the following (in bash):
alias sudo='sudo env PATH=$PATH'
sudo python setup.py install
For python3 use
sudo apt-get install cython3
For python2 use
sudo apt-get install cython
Details can be read at this
Run
which python
Thats the path to the python that your system has defaulted too
then go to #tiago's method of:
sudo <output of which python> setup.py install
I only got one advice for you : Create a virtualenv. This will ensure you have only one version of python and all your packages installed locally (and not on your entire system).
Should be one of the solutions.
In the CLI-python, import sys and look what's inside sys.path
Then try to use export PYTHONPATH=whatyougot
Running the following commands resolved the issue for me in ubuntu 14.04:
sudo apt-get install python-dev
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libsystemd-daemon-dev
sudo pip install cython
This link helped me: https://github.com/trezor/python-trezor/issues/40
Ran into this again in modern times. The solution was simple:
pip uninstall cython && pip install cython
Read like a thousand of these threads and finally got it for Python 3. (replace pip with pip3 if you have that kind of installation, and run pip uninstall cython if you have tried other solutions before running any of these)
Mac:
brew install cython
pip install --upgrade cython
Ubuntu
sudo apt-get install cython3 python-dev
pip install --upgrade cython
Windows (must have conda, and MinGW already in path)
conda install cython
conda install --upgrade cython
That is easy.
You could try install cython package first.
It will upgrade your easy_install built in python.
I had dependency from third party library on Cython, didn't manage to build the project on Travis due to the ImportError. In case someone needs it - before installing requirements.txt run this command:
pip install Cython --install-option="--no-cython-compile"
Installing GCC also might help.
Just install Cython from
http://cython.org/#download
and install it using this command
sudo python setup.py install
Then run the command
sudo python -c 'import Cython.Distutils'
and it will be installed and the error message will disappear.
I tried to import the module but i am getting the error shown below:-
sh-3.2# python -V
Python 2.6.4
sh-3.2# python -c "import httplib2"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named httplib2
How to fix this Error?
httplib2 is not part of the Python standard library. It's an external package you must install yourself.
using pip:
pip install httplib2
You need to install the httplib2 package from your package manager.
On Ubuntu:
sudo apt-get install python-httplib2
I suppose you could start by installing httplib2.
Download it?
Make sure it's on your PYTHONPATH
Suppose you can start by installing it like :
$ pip install httplib2
you can try the same thing with easy install too, or if you wanted to install in locally and not over the network then go to httplib2 github .
Clone/download it to your computer. Now go to the downloaded httplib2 folder location and run the setup.py like this :
$ setup.py install
If on windows, make sure you have successfully installed python first and have set the environment variables path successfully.
This is a common command to install any module using pip or by locally downloading and looking for the foldert location>setup.py file and trying the second command mentioned above.
FOR WINDOWS:
if python is installed & set as environment variable
python -m pip install httplib2