Python3 won't recognize sqlite - python

I have python3 installed on linux. In the python interpreter, I tried
import sqlite3
and got
ImportError: No module named '_sqlite3'
so i installed sqlite with
sudo apt-get install libsqlite-dev
and then recompiled python according to the instructions in the README file:
cd ~/Python-3.4.2;
./configure;
make;
make test;
and during test there was an error saying
[ 97/389] test_sqlite
test_sqlite skipped -- No module named '_sqlite3'
and then when I finished the install and tried to run the same python code, I still got the same ImportError. What am I doing wrong?
---EDIT---
I tried
pip install pysqlite
and got this error, which seems to be an issue between Python2.7 and Python3.4:
Downloading/unpacking pysqlite
Downloading pysqlite-2.6.3.tar.gz (76kB): 76kB downloaded
Running setup.py (path:/tmp/pip_build_plat/pysqlite/setup.py) egg_info for package pysqlite
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_plat/pysqlite/setup.py", line 85
print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
^
SyntaxError: Missing parentheses in call to 'print'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_plat/pysqlite/setup.py", line 85
print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_plat/pysqlite
Storing debug log for failure in /home/plat/.pip/pip.log

After install libsqlite-dev you should install pysqlite
pip install pysqlite

Related

ImportError: No module named _winreg, Installing pypiwin32==219 on MacOS X

I am trying to install pypiwin32==219 in my virtual environment from a requirements.txt file.
requirements.txt
pypiwin32==219
I have setup a virtualenv denv in which I am working.
(denv) Nehas-MacBook-Pro:dash_pdf neha$ pip install -r requirements.txt
I got this traceback error:
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/_y/g09fpxn13xq7z6ptmq3095dm0000gn/T/pip-install-7zp59n5n/pypiwin32/setup.py", line 121
print "Building pywin32", pywin32_version
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Building pywin32", pywin32_version)?
which really is a python version issue so I switched to the command:
(denv) Nehas-MacBook-Pro:dash_pdf neha$ pip2 install -r requirements.txt
upon which I get this traceback error:
Using cached https://files.pythonhosted.org/packages/2b/ca/5c086c18de8f70222787b3e824e755b68d99272531522e77bb381d4f60c8/pypiwin32-219.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/_y/g09fpxn13xq7z6ptmq3095dm0000gn/T/pip-install-KEpN56/pypiwin32/setup.py", line 83, in <module>
import _winreg
ImportError: No module named _winreg
I googled some and I found that _winreg required Windows. No way I can get pypiwin32==219 to work on MacOS? Or any other modules I can use with the same functionality?
i suggest, that winreg is only for Windows

Read the Docs: Distutils2 error during installation

I try to install local instance of Read the Docs on my Win10
When I follow this documentation:
http://docs.readthedocs.io/en/latest/install.html
and type:
pip install -r requirements.txt
I get this error:
Collecting Distutils2==1.0a3 (from -r requirements/pip.txt (line 65))
Using cached Distutils2-1.0a3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\USER\AppData\Local\Temp\pip-build-xseiavup\Distutils2\setup.py", line 9, in <module>
from distutils2.util import find_packages
File "C:\Users\USER\AppData\Local\Temp\pip-build-xseiavup\Distutils2\distutils2\util.py", line 174
except KeyError, var:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\USER\AppData\Local\Temp\pip-build-xseiavup\Distutils2\
Anyone know this error?
My pip version: 8.1.2;
python: 3.5
Is it possible you are running the Python 2 pip? The error message clearly indicates that the code is being executed under Python 3 but has Python 2 syntax. Do you get better results with
python -m pip install -r requirements.txt
I wonder? If not then verify that
python
runs version 3.5 ...
Oh. I just checked and the disutils2 page on PyPI says
Distutils2 development is stopped.
tl;dr: keep using setuptools and pip for now, don’t use distutils2.
It looks like there was never a Python 3 version. Looks like you might need to update your code.

ImportError: No module named extern;

I'm trying to install fuel and blocks with
pip install git+git://github.com/mila-udem/blocks.git#v0.0.1
pip install git+git://github.com/mila-udem/fuel.git#v0.0.1
(I was using the root account)
Then I encountered the problem
pip install git+git://github.com/mila-udem/fuel.git#v0.0.1
Downloading/unpacking git+git://github.com/mila-udem/fuel.git#v0.0.1
Cloning git://github.com/mila-udem/fuel.git to /tmp/pip-PnqUs3-build
Running setup.py (path:/tmp/pip-PnqUs3-build/setup.py) egg_info for package from git+git://github.com/mila-udem/fuel.git
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "build/bdist.linux-x86_64/egg/setuptools/__init__.py", line 11, in <module>
File "build/bdist.linux-x86_64/egg/setuptools/extern/__init__.py", line 1, in <module>
ImportError: No module named extern
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 3, in <module>
File "build/bdist.linux-x86_64/egg/setuptools/__init__.py", line 11, in <module>
File "build/bdist.linux-x86_64/egg/setuptools/extern/__init__.py", line 1, in <module>
ImportError: No module named extern
----------------------------------------
Cleaning up...
I have tried to reinstall/update setuptools and still can't get it work. Thanks.
download: https://pypi.python.org/pypi/extern/0.1.0
install: tar zxf extern-0.1.0.tar.gz && python setup.py install
I had the same issue on CentOS7 and got it resolved by doing:
pip install -U extern
You can cross check in your active python version, if you can import the module extern. If that works, then rebuild your easy_install from the downloaded ez_setup.py. e.g. /opt/bin/python ez_setup.py
This will include the extern module into the easy_install routine and the error doesn't show up anymore.
Running then /opt/bin/easy_install <your.egg> should do the job. Note: if you have more than one python version, use fully qualified names or softlinks you created in /usr/bin/

python-daemon 2.0.5 won't install with pip

I am getting errors when trying to install python-daemon 2.0.5 with pip & python 2.6. I know there are other questions that refer to python-daemon 2.0.3 having this problem. But those answers indicate it should be fixed now.
I've tried installing older versions as well without luck. Although if I start over with a fresh virtualenv I am able to install 1.5.6 . However in this virtualenv I get the same error with 2.0.5 and 1.5.6
(py26)[brianb#api proj]$ pip install python-daemon
Downloading/unpacking python-daemon
Downloading python-daemon-2.0.5.tar.gz (71Kb): 71Kb downloaded
Running setup.py egg_info for package python-daemon
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/brianb/py26/build/python-daemon/setup.py", line 26, in <module>
import version
File "version.py", line 438
for item in versions}
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/brianb/py26/build/python-daemon/setup.py", line 26, in <module>
import version
File "version.py", line 438
for item in versions}
^
SyntaxError: invalid syntax
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/brianb/.pip/pip.log
This is strange! I tried to upgrade virtualenv too, but this did not work out.
To get it running, I had to upgrade to Python 2.7.

running pip install from python 2.7.5

I have a CentOS server (5.6) which has Python 2.4.3 on it. I have another local installation of Python (2.7.5) installed in /opt and soft-links created as follows /usr/local/bin/python2.7 and /usr/local/python2.7. I want to install python-requests using pip. While installing using the command pip install requests, I get the following error:
root ~/ff_test_ff # pip install requests
Unpacking ./requests
Running setup.py egg_info for package from file:///root/ff_test_ff/requests
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/tmp/pip-MM685m-build/setup.py", line 6, in ?
import requests
File "requests/__init__.py", line 58
from . import utils
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/tmp/pip-MM685m-build/setup.py", line 6, in ?
import requests
File "requests/__init__.py", line 58
from . import utils
^
SyntaxError: invalid syntax
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /root/.pip/pip.log
I'm assuming it's still trying to use Python 2.4. I checked here which says 2.4 isn't supported. So how do I run the pip install command but use python2.7 instead?
you need to set the PYTHONPATH / PYTHONHOME like here
you can also try to install virtualenv
You probably should (re)install a new version of pip explicitly for the new Python version. On pip installation instructions page it says that
pip works with CPython versions 2.6, 2.7, 3.1, 3.2, 3.3 and also pypy.
While installing, be sure to use the newer version of Python instead of the old one.

Categories

Resources