4

I use Webfaction, and this is the command line for the shared host.

[zallarak@web198 ~]$ python2.6
Python 2.6.5 (r265:79063, Nov 23 2010, 02:02:03) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import stripe
>>>

[zallarak@web198 ~]$ python2.7
Python 2.7.1 (r271:86832, Dec  1 2010, 06:29:57) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import stripe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named stripe

I know there must be a simple way to make it work in all version of Python. I would much appreciate any insight on how to make this work/the concept behind it.

My version of Django runs on 2.7, so the goal is to make it work on 2.7

A B
  • 8,340
  • 2
  • 31
  • 35
zallarak
  • 5,287
  • 7
  • 38
  • 54

2 Answers2

4

Your problem is that the stripe module is not installed in each python environment.

I know there must be a simple way to make it work in all version of Python.

You must install stripe in each environment. According to your webhost, you should be able to install them with easy_install. Try this:

python2.7 `which easy_install` stripe
Brian Cain
  • 14,403
  • 3
  • 50
  • 88
  • [zallarak@web198 ~]$ python2.7 `which easy_install` stripe Traceback (most recent call last): File "/usr/bin/easy_install", line 5, in from pkg_resources import load_entry_point File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 2607, in parse_requirements(__requires__), Environment() File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 565, in resolve raise DistributionNotFound(req) # XXX put more info here pkg_resources.DistributionNotFound: setuptools==0.6c5 Is the response I get. – zallarak Dec 03 '11 at 02:54
  • Try `python2.7 \`which easy_install\` -U setuptools`. Then repeat the command above. – Brian Cain Dec 03 '11 at 23:08
  • 1
    thanks for the help. I did this: [http://community.webfaction.com/questions/6365/problems-installing-pycurl] then ran the install command [pip install --index-url https://code.stripe.com --upgrade stripe] and it worked. – zallarak Dec 07 '11 at 00:11
3

Brian Cain is correct about it not being installed in the Python version you are using. Instead of the command he gave you should run:

easy_install-2.7 stripe

After making sure that the directory: /home/username/lib/python2.7/ actually exists. If it doesn't you can use the command: mkdir -p /home/username/lib/python2.7 to create it.

That will install it in your Python2.7 installation, which you can then use from Django on Python2.7.

Note: If you get the error: "Need libcurl version 7.19.0 or greater to compile pycurl." you'll need to follow the instructions here:

http://community.webfaction.com/questions/6365/problems-installing-pycurl

to install your own version of curl on your account.

Klynton
  • 81
  • 5
  • Hmm...I'd assume they'd be equivalent. As far as I can tell, the python2.7 install has a `setuptools` package which does not meet the requirements of the package. I look forward to hearing the outcome of these experiments. – Brian Cain Dec 03 '11 at 23:08
  • For some reason they aren't equivalent: `[klynton@web98 ~]$ python2.7 Python 2.7.1 (r271:86832, Dec 1 2010, 06:29:57) Type "help", "copyright", "credits" or "license" for more information. >>> import setuptools >>> print setuptools >>> setuptools.__version__ '0.6c11' >>> ` But as long as the newer version of curl is installed everything else works great: `Finished processing dependencies for stripe [klynton@web98 ~]$ python2.7 >>> import stripe >>> import pycurl >>> ` – Klynton Dec 05 '11 at 23:48