10

Greetings to everyone!

I've got a little issue in a project made by someone in PyCharm, with virtual environment(VE) precisely. I've set this VE up few months ago and didn't use it for some time. Now i need to go back to it, because it has a lot of necessary things installed. Therefore there is one more battery needed to be installed into this VE - it is soundcloud API. I installed by directly from PyCharm in project settings, i checked whether this VE is still a default VE - it is. But project keeps complaining that there is "No module named soundcloud".

Can you show me the way i can fix this?

Thanks in advance.

1 Answer 1

11

In settings, under the Project section (in the left pane) go to Interpreters. From there you can select a found environment or click the + to add your own from a path. Find the environment you created and add it to the list. Then, once you select the environment you can see the installed modules underneath. You can add new modules through their built in pip.

After that, it'll take you to the first page where you have to select your custom environment from a drop down.

Good luck!

Edit: Reread your question. Sometimes when I can't get the module to be recognized in PyCharm, I do a pip install through the command line in the virtual environment. Then restart PyCharm.

Navigate to the environment in cmd and run python -m pip install -U SOUNDCLOUD_MODULE and it'll work.

Sign up to request clarification or add additional context in comments.

5 Comments

worth mentioning that from the terminal you want to make sure you are running the virtualenv's python. I usually ensure this by running source bin/activate from inside the virtualenv directory.
Thank you for answers. Installing necessary module by pip and activating VE like Pathetique told saved the day.
I'm wondering if there is no way to do this in PyCharm directly. At least I haven't found one so far. The method you describe here (after Edit:...) works perfectly fine though.
I did the Alt+ENTER quickfix on a import module line, and PyCharm installed it into the virtualenv lib configured under Interpreters.
@aoeu256 That's a pretty neat new feature! Explained: type import YOUR_MODULE in a PyCharm .py file -- then press Alt+Enter to bring up a context menu that allows you to install the module if it's unfound. This will install it into the current Python Interpreter (found in Project Settings)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.