IDE Issue for Python Program

python
#1

I am writing python 3 program in IDE however, I get following error for importing Pandas in python.
import pandas as pd
ModuleNotFoundError: No module named ‘pandas’

However, I have also installed Anaconda and with that I used Jupyter Notebook to run the same program and it was successful.
How can I solve this issue

0 Likes

#2

Dear prashantdang,

I think Pandas is not installed on Cloud9 machines by default. I can suggest three options.

  1. Install miniconda. Since you use Anaconda, this will provide the tools you used before, like conda to install libraries and manage environments. You just need to download the installer using wget and run it. I once saw a Youtube video that walks through installing miniconda on Cloud9. Disadvantage: Even miniconda takes up a lot of storage on the virtual machine and you may run out if you are doing other things on it.
  2. Install individual modules from APT. Many popular Python libraries, like Pandas, are available through repositories that you can access with APT. In the Cloud9 terminal, run sudo apt-get update -qq and then sudo apt-get install python-pandas. If all you need is Pandas and dependencies, this is probably the easiest option.
  3. Install individual modules using Pip. This will only download the libraries you need (and their dependencies). For example, you would use pip install pandas. Pip can be tricky to use in a Cloud9 machine because you need to manage permissions issues. I recommend using a virtual environment, as below. Within this virtual environment, you can install other modules, like Flask or Seaborn, using Pip. Disadvantage: It can be tricky to configure a Cloud9 runner to use a virtual environment.
    $ sudo apt-get install python-virtualenv
    $ virtualenv venv
    $ source venv/bin/activate
    $ pip install pandas
0 Likes