Can't install pyspatialite with python3 and sqlite3 - python

I can't install pyspatialite. When I try it gives me this error:
pip install pyspatialite
Downloading/unpacking pyspatialite
Could not find a version that satisfies the requirement pyspatialite (from versions:
2.6.2-spatialite.2.3.1, 2.6.2-spatialite.2.4.0-4, 3.0.1-alpha-0)
Cleaning up...
No distributions matching the version for pyspatialite
Storing debug log for failure in /home/jenia/.pip/pip.log
The python interpreter that's installed in the virtualenv is 3.4.1.
When I run explicetly:
pip install pyspatialite==2.6.2-spatialite.2.4.0-4
I get this:
Running setup.py (path:/home/jenia/pip/app/build/pyspatialite/setup.py) egg_info for package pyspatialite
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/jenia/pip/app/build/pyspatialite/setup.py", line 83
print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/jenia/pip/app/build/pyspatialite/setup.py", line 83
print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
^
SyntaxError: invalid syntax
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/jenia/pip/app/build/pyspatialite
Storing debug log for failure in /home/jenia/.pip/pip.log
Does anyone know how to fix this error?
Thanks in advance for your time and kind concern.
Jenia.

I looked briefly at this problem (having had the same problem myself) and unfortunately the news is not good.
It turns out that pysqlite's install script doesn't even support Python3 for mostly trivial reasons, in this case. The error that you are seeing is related to this line of code, a print statement which was deprecated in Python3 in favor of the print function.
So the error that you were seeing (well, that I'm seeing as well) is actually a syntax error in the setup.py script. This is pretty unfortunate, since in this case, it would have been a mostly trivial change to a syntax that has been deprecated for almost 6 years now.
Now that may not be the only thing that's not Python3 safe in the package, so for now it's safe to say that Python3 is not supported by pysqlite. (I'll personally take a look and see if the changes required would be trivial enough that I can put together a pull request in a couple hours).

Related

Installing hashLib gives SyntaxError: Missing parentheses in call to 'print'

I needed a simple hash function for passwords and thought I could use hashlib. PyCharm suggested to install it by running pip install hashLib.
But now PyCharm is complaining about a syntax error in the library:
Collecting hashLib
Using cached https://files.pythonhosted.org/packages/74/bb/9003d081345e9f0451884146e9ea2cff6e4cc4deac9ffd4a9ee98b318a49/hashlib-20081119.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/6_/8g1vyy5n1t1859x2d30ssk480000gn/T/pycharm-packaging/hashLib/setup.py", line 68
print "unknown OS, please update setup.py"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("unknown OS, please update setup.py")?
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/6_/8g1vyy5n1t1859x2d30ssk480000gn/T/pycharm-packaging/hashLib/
It suggests that it may be a problem related to the Python version I am using (I tried with Python 2.7 and Python 3.8, but none of them worked).
Make sure that you use a version of Python supported by this package.
Currently you are using Python 3.8.
hashlib is in the standard library now. That means you don't need to install it, it's there already with your Python installation.
The one you tried to install from PyPI is for very old versions of Python (<= 2.4).

Error while Installing IMDbPY on MacBook

I am trying to install IMDbPY on my MacBook running on 10.12.4 with python version 3.5.2. I did find a couple of question threads addressing the issue but the suggestions offered do not seem to help me.
Following are the outputs from my terminal.
host-vlth5x-205:IMDbPY-3.5 apple$ pip install IMDbPY
Collecting IMDbPY
Using cached IMDbPY-5.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/gd/f_5prpbn13j_xy22k_4nlvgh0000gn/T/pip-build-k_hgg84y/IMDbPY/setup.py", line 200
print 'Created locale for: %s.' % ' '.join(languages)
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/gd/f_5prpbn13j_xy22k_4nlvgh0000gn/T/pip-build-k_hgg84y/IMDbPY/
Post this, I have tried downloading the latest stable version of IMDbPY-3.5 here and installing the package manually via the terminal, which gave me the following error:
host-vlth5x-205:IMDbPY-3.5 apple$ python setup.py
File "setup.py", line 128
except SystemExit, e:
^
SyntaxError: invalid syntax
Please help me figure this out. Thanks!
Currently, IMDbPY is a Python 2.7-only library. It can't (yet) work on Python 3.x.
To fix your problem, install Python 2.7

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.

virtualenvwrapper syntax error while setting up for python in powershell

At the moment I'm following this guide to set up python with the purpose of making a python scraper. I'm attempting to install Vitualenvwrapper which should be a simple pip command but I keep getting a syntax error. I have attempted the fixes listed (even though the one I have found don't list a syntax error as a problem). Can anyone shed some light on this for me?
$ C:\Users\nik> pip install virtualenvwrapper-powershell
Collecting virtualenvwrapper-powershell
Using cached virtualenvwrapper-powershell-12.7.8.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\nik\AppData\Local\Temp\pip-build-c37hzy_b\virtualenvwrapper-powershell\setup.py", line 76
TOKEN_READ = 0x00020000L | 0x0008
^
SyntaxError: invalid syntax
Command "python setup.py egg_info" failed with error code 1 in C:\Users\nik\AppData\Local\Temp\pip-build-c37hzy_b\virtualenvwrapper-powershell\
The issue here is that its defaulting to using Python 3.x. You probably have a reference to Python3.x in your environment PATH.
Open System your machine, go to Advanced Settings -> Environment Variables and edit your PATH. Remove entries for Python3.x and leave the Python2.7 entries behind.
Open up PowerShell, type python, hit enter and verify that python 2.7 runs.
Re-run your command:
pip install virtualenvwrapper-powershell
Then you should find it all works.
Of course be aware that removing Python3.x from your path might affect other things that you may be using python3 for, so just remember the entries you removed in case in the future you find anything not working that relied on python3.

python setup.py egg_info failed with error code 1

I'm trying to install pystashop module.
I have a Python 3.4 installed on Windows 7 64 bits.
When I try pip install pystashop I get this error:
Collecting pystashop
Downloading pystashop-0.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "C:\Users\Me\AppData\Local\Temp\pip-build-zyt3yyca\pystashop\setup.py", line 12, in <module>
execfile(os.path.join('pystashop', 'version.py'))
NameError: name 'execfile' is not defined
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Me\AppData\Local\Temp\pip-build-zyt3yyca\pystashop
how can I solve this?
ADD:
I tryed to install and run 'python ez_setup.py' and after run 'easy_install pip' but with no success. Still getting the same error.
execfile is a standard library builtin in Python 2. It was removed in Python 3, which means that pystashop does not support Python 3. You should try contacting the developer(s) and request Python 3 support, and in the meantime see if you can get by with Python 2.
You can attempt to remedy the situation yourself by cloning the GitHub repo, making changes, and installing with python3 setup.py install, but there's no guarantee that it will work properly. The offending code seems to be here:
execfile(os.path.join('pystashop', 'version.py'))
You can replace this with the following:
exec(open(os.path.join('pystashop','version.py')).read())
This will provide the expected functionality. From a cursory glance over the code, everything else appears to be compatible with Python 3, though I may have missed something.

Categories

Resources