Hydrogen issues: 'ModuleNotFoundError'


#1

Hi all,

I’ve just started using Atom and Hydrogen to develop my projects. I’ve made the switch from Jupyter Notebook so I can expand my understanding of code development. So far it’s off to a rocky start, but I’m piecing things together.

I’ve come upon an unusual scenario where I have created a virtual environment called ‘test2’ using virtualenvwrapper. Once made I installed packages to the environment, specifically ‘requests’ and ‘beautifulsoup4’ to perform website scrapping. Now moving over to Atom, when I use go to import the packages or modules from them I am successful at accessing ‘requests’, but Hydrogen seems to not find ‘bs4’. I get a ‘ModuleNotFoundError’. I ran python3 in my terminal and it can import ‘bs4’ just fine, so I have no clue what’s happening.

Can anyone shed some light on my situation?

Thanks!


#2

I feel like Hydrogen’s probably looking at the globally installed Python packages, not your virtual environment. What happens if you install bs4 globally?


#3

Ah, that did the trick! Now I’m confused as to why it isn’t looking in the python environment that I have activated. I thought the point of having an environment is so that I can have env packages that are different versions to my global set or not even in my global set.

How do I have hydrogen look only in the current environment?


#4

Yes, it is. But in order to do that, python3 has to receive information about a current working directory that’s inside a virtual environment folder. If Hydrogen hasn’t been told how to pass that along, it might not do so.

Did you have the environment set up when you were using Jupyter Notebook?


#5

Yeah, I would activate the environment before opening a jupyter notebook and it seemed to use the packages only in that environment. I’m still trying to wrap my head around how all these things communicate.