Note that there are some explanatory texts on larger screens.

plurals
  1. POipython install new modules
    text
    copied!<p>I am used to the R functionality of installing packages and I am trying to do the same thing with ipython. Sometimes the following method works but then again sometimes it doesn't and I would like to finally find out why it only works half the time. </p> <p>Normally to install a module (like the <code>requests</code> module for example) I would type the following after opening a fresh terminal: </p> <pre><code>$ sudo pip install requests Password: ******* </code></pre> <p>This would then be followed by a message indicating that the install was succesfull or that it has already been installed. </p> <pre><code>Requirement already satisfied (use --upgrade to upgrade): requests in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages Cleaning up... </code></pre> <p>Which suggests that the code can be accessed. And indeed if I run python now from the terminal it shows a good response without any errors whatsoever. </p> <pre><code>$ python ActivePython 2.7.2.5 (ActiveState Software Inc.) based on Python 2.7.2 (default, Jun 24 2011, 12:20:15) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import requests &gt;&gt;&gt; </code></pre> <p>I now open PyLab through Alfred and it gives me an error. </p> <pre><code>Welcome to pylab, a matplotlib-based Python environment [backend: WXAgg]. For more information, type 'help(pylab)'. In [1]: import requests --------------------------------------------------------------------------- ImportError Traceback (most recent call last) /Users/vincentwarmerdam/&lt;ipython-input-1-686486c241c8&gt; in &lt;module&gt;() ----&gt; 1 import requests ImportError: No module named requests </code></pre> <p>I've read some help from another question on stackoverflow (here <a href="http://bit.ly/1148FRL">http://bit.ly/1148FRL</a>) which suggests that I install the module from ipython shell. This gives an even more baffeling response: </p> <pre><code>In [2]: !pip install requests Requirement already satisfied (use --upgrade to upgrade): requests in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages Cleaning up... In [3]: import requests --------------------------------------------------------------------------- ImportError Traceback (most recent call last) /Users/vincentwarmerdam/&lt;ipython-input-3-686486c241c8&gt; in &lt;module&gt;() ----&gt; 1 import requests ImportError: No module named requests </code></pre> <p>This seems very strange to me. Are there multiple versions of python installed on the system? How could I check this? Do I need to point ipython to the location of the installed code? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload