I am a novice Vagrant user and have a trusty64 box up. I do:
sudo apt-get install -y python-pip
sudo pip install --upgrade setuptools
Then this happens.
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 7, in <module>
from scrapy.cmdline import execute
File "/usr/local/lib/python2.7/dist-packages/scrapy/__init__.py", line 34, in <module>
from scrapy.spiders import Spider
File "/usr/local/lib/python2.7/dist-packages/scrapy/spiders/__init__.py", line 10, in <module>
from scrapy.http import Request
File "/usr/local/lib/python2.7/dist-packages/scrapy/http/__init__.py", line 11, in <module>
from scrapy.http.request.form import FormRequest
File "/usr/local/lib/python2.7/dist-packages/scrapy/http/request/form.py", line 11, in <module>
import lxml.html
ImportError: No module named lxml.html`
What on earth do I do here? First I tried installing via pip3 but then read that Twisted is in 2. How do I just get this right?
UPDATE:::
#Paula: So I destroyed and initialized it with
sudo apt-get install -y python-dev libxml2-dev libxslt1-dev zlib1g-dev python-pip
sudo pip install --upgrade setuptools
sudo pip install Scrapy
and on SCRAPY install I get THIS printed at me more than once:
x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
Compile failed: command 'x86_64-linux-gnu-gcc' failed with exit status 4
How about that?
You need to run this first.
sudo apt-get install python-dev libxml2-dev libxslt1-dev zlib1g-dev
As #Cfreak says you have unmet library dependencies.
Related
I am trying to run my python script in Debian but I keep getting the following error:
traceback (most recent call last):
File "gluon/contrib/websocket_messaging.py", Line 96, in <module>
import gluon.utils
ImportError: No module named utils
I've tried:
pip install gluon
Still didn't work. I also tried:
sudo apt-get update
sudo apt-get install python-gluon
but got
Unable to locate package python-gluon
Any help would be appreciated thank you
sudo apt-get update
sudo apt-get install python3-gluon
OR
pip3 install gluon
I installed python3 and pip3 successfully on my Ubuntu16.04, but pip3 install is broken. How can I fix this problem? The error info of pip3 install is as follows:
# pip3 install xlwt
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'
Output of "which pip3" and "pip3 --version":
# which pip3
/usr/bin/pip3
# pip3 --version
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'
p.s. Python2 pip runs successfully.
Output of "which pip" and "pip --version":
# which pip
/usr/bin/pip
# pip --version
pip 1.5.4 from /usr/local/lib/python2.7/dist-packages/pip-1.5.4-py2.7.egg (python 2.7)
And python and python3 installation information:
# which python
/usr/bin/python
# which python3
/usr/bin/python3
# python -V
Python 2.7.14
# python3 -V
Python 3.6.3
Any solution or clue will be appreciated! Thank you!
Here, trying this method: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
# sudo python3 get-pip.py
This has happened to me multiple times before. A lot of the time, pip3 has issues installing with python3 by default, so try uninstalling and reinstalling pip3. Hope this works.
sudo apt-get remove python3-pip; sudo apt-get install python3-pip
EDIT:
After doing some scouting about pip.vendor.requests, it seems like this is a very common error relating to SSL problems. If this line gives you errors in python (import ssl), some solutions can be found here:
https://github.com/pypa/pip/issues/2345.
This worked for me.
First remove your python3-pip:
sudo apt remove python3-pip
Then do this:
sudo apt install --purge python3-setuptools
And finally:
sudo apt install python3-pip
python-pip is in the universe repositories, therefore use the steps below to solve Python3 pip3 broken problem on Ubuntu. Also works for Ubuntu available from official store in windows 10 for WSL (windows subsystem for linux):
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get -y install python3-pip
I got help from here - [https://askubuntu.com/a/672836/876942]. Following these steps installs python 2. But then I installed python 3 using [sudo apt-get -y install python3-pip] in last step.
I installed tkinter from yum,but I can only use it in Python2.
This is in Python3:
>>> import tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/tkinter/__init__.py", line 38, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named '_tkinter'
and I can use "import Tkinter" in python2.
But how i can use it in Python3, Thanks.
Install python3:
sudo apt-get update
sudo apt-get install python3.5
If you have already done that, ge the setuptools:
sudo apt-get install python3-setuptools
sudo apt-get upgrade python3-setuptools
After which install tkinter:
sudo -H pip3 install tkinter
I have just done a fresh install of Linux Mint 17.3. It comes with both python 2.7 and 3.4. I usually work with multiple versions of python so I just do an altinstall and then for each project I create a virtualenv using the desired version of python. However im running into issues with the newly installed OS. First a few things i've already done following the install:
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install python-virtualenv
sudo apt-get install python-pip
I did an altinstall of python3.3.5:
downloaded the source tarball
./configure --with-zlib
sudo make
sudo make altinstall
I then tried creating a virtualenv in a new folder to test:
virtualenv -p python3.3 venv
This gave an error:
no module named zlib
I've had this issue in the past, so I did:
sudo apt-get install python-dev
sudo apt-get install zlib1g-dev
Now when I create the virtualenv the zlib error is gone, however im getting a new error and I can't seem to figure out how to fix it:
Running virtualenv with interpreter /usr/local/bin/python3.3
Using base prefix '/usr/local'
New python executable in venv/bin/python3.3
Also creating executable in venv/bin/python
Installing setuptools, pip, wheel...
Complete output from command /home/vega/Documents...8/venv/bin/python3.3 -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/__init__.py", line 15, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/vcs/subversion.py", line 9, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/index.py", line 30, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/wheel.py", line 35, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/_vendor/distlib/scripts.py", line 14, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/_vendor/distlib/compat.py", line 66, in <module>
ImportError: cannot import name HTTPSHandler
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2363, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 832, in main
symlink=options.symlink)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1004, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 969, in install_wheel
'PIP_NO_INDEX': '1'
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 910, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/vega/Documents...8/venv/bin/python3.3 -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1
I read somewhere that this might have something to do with openssl so I did:
sudo apt-get install openssl
sudo apt-get install libcurl4-openssl-dev
No luck, still having the same issue.
I let someone else do the work, so I don't have to worry about building alterante versions myself from source.
I've had really good luck using Felix Krull's "deadsnakes" PPA for installing alternate Pythons on Ubuntu. Would this work for Mint 17? (based on Ubuntu Trusty)
'deadsnakes PPA' packages versions of Python: 2.3, 2.4, 2.5, 2.6, 2.7, 3.1, 3.2, 3.3, 3.4, 3.5 ... all available to install from apt. Once installed, You can manage versions and dependencies with virtualenv and pip.
Installing Python 3.5 from deadsnakes PPA:
$ sudo add-apt-repository ppa:fkrull/deadsnakes
$ sudo apt-get update
$ sudo apt-get install python3.5 python3.5-dev
The PPA maintainer has maintained these for quite a long time and updates with each Ubuntu release.
https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes
root#syscomp1:~# cd Pillow-master
root#syscomp1:~/Pillow-master# python3 selftest.py
Traceback (most recent call last):
File "selftest.py", line 8, in <module>
from PIL import Image
File "./PIL/Image.py", line 155, in <module>
if hasattr(core, 'DEFAULT_STRATEGY'):
File "./PIL/Image.py", line 39, in __getattr__
raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed
root#syscomp1:~/Pillow-master#
this is the step before i install PIL
sudo apt-get install python-pip python-dev build-essential
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
sudo aptitude install python3-setuptools
sudo easy_install3 pip
sudo apt-get install python3-dev
download the Pillow-master.zip
wget https://github.com/python-imaging/Pillow/archive/master.zip
go to downloaded directory and,
sudo unzip master.zip
sudo apt-get install libjpeg62-dev //must install this
sudo apt-get install zlib1g-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install liblcms1-dev
python3 setup.py build_ext -i
but error with The _imaging C module is not installed why?
Looks like a Python 2 print statement in setup.py:
Downloading from URL http://effbot.org/media/downloads/PIL-1.1.7.tar.gz (from http://effbot.org/downloads/)
Running setup.py egg_info for package pil
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "<pyenv>/build/pil/setup.py", line 182
print "--- using Tcl/Tk libraries at", TCL_ROOT