Dhruv Ghulati
Dhruv Ghulati

Reputation: 3026

Cannot install modules via pip running on python 3.4

I have been trying to install various modules that I need to have to run this script:

https://github.com/austingandy/slack-evernote/blob/master/slackwriter.py

I am working off a Mac, and my python --version is:

Python 3.4.3 :: Anaconda 2.3.0 (x86_64)

And I have for python -m pip --version:

pip 8.0.2 from /Users/dhruv/anaconda/lib/python3.4/site-packages (python 3.4)

However, for example when I run pip install evernote I get errors like:

Collecting evernote
  Using cached evernote-1.25.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/cj/5gs43w4n2tz313rrnz9_htf00000gn/T/pip-build-0y7hm202/evernote/setup.py", line 6
        exec x
             ^
    SyntaxError: Missing parentheses in call to 'exec'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/cj/5gs43w4n2tz313rrnz9_htf00000gn/T/pip-build-0y7hm202/evernote

I have a feeling that these errors are because the setup.py code that pip has is in python 2.7 format, and my environment is 3.4, but how can I overall install all the packages I need to run this script? Would I change to python 2.7, install in that environment, and then repackage the setup of evernote into python 3.4 format? If so, how?

Upvotes: 3

Views: 935

Answers (2)

Andrey Taptunov
Andrey Taptunov

Reputation: 9495

AFAIK, Evernote SDK for Python 3 is not yet supported.

https://github.com/evernote/evernote-sdk-python3

This is a test SDK! The official Evernote SDK for Python doesn't support Python 3 yet; this repository is an experiment as we try to migrate.

You can try installing manually from the link above or downgrade to python2 in your virtual env.

Upvotes: 3

jsfan
jsfan

Reputation: 1373

While it is possible to migrate a script from Python 2 to Python 3, doing it right isn't trivial. You could try using 2to3 but I suspect it won't quite do the job.

The easiest is to just use virtualenv with Python 2. I'm not sure how it is on Mac but on Linux you can just have both versions of Python installed in parallel and you can pick the one you need in your virtualenv as e.g.

virtualenv -p python2 venv

where python2 is your Python 2 binary and venev the directory you want tot install the virtualenv into.

Where you might run into trouble is the activate scripts which are only available for specific shells. However, you could probably adapt one if none works out of the box.

Upvotes: 0

Related Questions