3

So I've tried to follow the answer here but have no luck: https://forums.aws.amazon.com/thread.jspa?messageID=822214&tstart=0

Only line in my python file is from bs4 import BeautifulSoup which returns ImportError: No module named bs4.

I've created my virtualenv and have activated it, terminal shows (vpy36) at the beginning of each line.

python --version returns Python 3.6.2

python -m pip install bs4 returns Requirement already satisfied: bs4 in /home/ec2-user/environment/vpy36/lib/python3.6/dist-packages (0.0.1)

Requirement already satisfied: beautifulsoup4 in /home/ec2-user/environment/vpy36/lib/python3.6/dist-packages (from bs4) (4.6.0)

Where am I going wrong?

Vincent Nguyen
  • 1,555
  • 4
  • 18
  • 33
  • What does `pip --version` return ? – BcK Apr 25 '18 at 13:53
  • `pip 10.0.1 from /home/ec2-user/environment/vpy36/local/lib/python3.6/dist-packages/pip (python 3.6)` – Vincent Nguyen Apr 25 '18 at 13:53
  • I am not sure but why is pip not in the vpy36/ folder and in the vpy36/local/ folder ? I might be wrong here. – BcK Apr 25 '18 at 14:03
  • @BcK I don't know? I think it is how AWS Cloud 9 is set up? If I deactivate virtualenv and do `pip --version` I get `pip 9.0.3 from /usr/local/lib/python2.7/site-packages (python 2.7)` – Vincent Nguyen Apr 25 '18 at 14:04
  • @VincentNguyen try installing pip3 with: `sudo apt-get install python3-pip` – radzak Apr 25 '18 at 14:51
  • @Jatimir AWS Cloud9 doesn't use apt-get it uses yum. I tried installing pip3 with yum, it just defaults to pip in my virtualenv – Vincent Nguyen Apr 25 '18 at 14:54
  • @VincentNguyen Oh yeah, I missed that. What's the output of `pip3 --version`? Have you installed python 3.6 through `yum install python36` like in [this answer](https://stackoverflow.com/a/47544610/4796844)? – radzak Apr 25 '18 at 15:07
  • `pip 9.0.1 from /usr/lib/python3.6/dist-packages (python 3.6)` But when I do `python3 -m pip3 install bs4` I get `No module named pip3` – Vincent Nguyen Apr 25 '18 at 15:10
  • @VincentNguyen I assumed you already tried that, but maybe you haven't. Just try to activate `virtualenv` and `pip install bs4`. – radzak Apr 26 '18 at 09:14

1 Answers1

0

I had to move my .py file into /home/ec2-user/environment/vpy36/lib/python3.6/dist-packages

Vincent Nguyen
  • 1,555
  • 4
  • 18
  • 33