I have just switched from using windows to ubuntu (12.04) and only started learning how to code a couple of months ago, so I'm really a beginner. I tried to do this in windows and I some questions here (didn't get any answers, but my questions were pretty vague) and I'd really appreciate if someone could help.
I am having trouble importing successfully installed packages. My original problem was very similar to the problem here and here. My version of pip would only install the 2.7 versions of modules I needed, even though it is necessary for me to use python 3.2 for some things. I followed the directions provided by AKAidiot for people with ubuntu 12.04 or less. I used the following code
sudo apt-get install python3-setuptools
sudo easy_install3 pip
This seemed to work properly. The only potential problem that I see is that everyone says I should be using the command pip-3.2. That does not work, and I use pip3.2 instead. Next, I try to install geopy. It says geopy installed succesfully, but I do get a bunch of errors.
Installing collected packages: geopy
*** Error compiling '/tmp/pip_build_root/geopy/geopy/geocoders/googlev3.py'...
File "/tmp/pip_build_root/geopy/geopy/geocoders/googlev3.py", line 277
u'pytz must be installed in order to locate timezones. '
^
SyntaxError: invalid syntax
*** Error compiling '/tmp/pip_build_root/geopy/geopy/geocoders/placefinder.py'...
File "/tmp/pip_build_root/geopy/geopy/geocoders/placefinder.py", line 72
signature_method=u"HMAC-SHA1",
^
SyntaxError: invalid syntax
*** Error compiling '/tmp/pip_build_root/geopy/geopy/location.py'...
File "/tmp/pip_build_root/geopy/geopy/location.py", line 21
def __init__(self, address=u"", point=None, raw=None):
^
SyntaxError: invalid syntax
Successfully installed geopy
Looking at the first error message, I thought a problem was the lack of pytz. I used `pip3.2 install pytz' and 'import pytz' No error messages showed up, and it seems to work properly. I then uninstalled geopy, and reinstalled geopy. The error message about the missing pytz did not dissappear.
Here is the error message when I try to import geopy.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.2/dist-packages/geopy/__init__.py", line 10, in <module>
from geopy.location import Location
File "/usr/local/lib/python3.2/dist-packages/geopy/location.py", line 21
def __init__(self, address=u"", point=None, raw=None):
I attempted to try this for other modules. These other modules are not vital for my current project, but I thought maybe there was a problem particular to geopy. When I tried to use pip3.2 install psycopg2 (and later pandas), it did not even install correctly. I got the following error message
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/psycopg2
Storing debug log for failure in /home/ravi/.pip/pip.log
Other modules, such as Geocoder and sqlalchemy had problems similar to geopy. Only pytz installed correctly.
When I try to import the package I get the following error. I looked through stack exchange for people who have had similar problems. Here are links to several potential answers I found. I am not sure I fully understood the answers to these problems, but I am pretty sure that these people face a problem different to the one I have. However, just to check I did
import sys
print(sys.path)
and in both the error message when I do import and the sys.path contain /usr/local/lib/python3.2/dist-packages
I'm not sure if it useful to know, but I installed python 3.2 using the Deadsnakes PPA, using the instructions provided here Everything works exactly as it should in python 2.7, and using virtualenv caused the same problems.
Apologies for the length of the question, and the fact that it is very specific, but I'm really desperate.