mathishard.butweloveit
mathishard.butweloveit

Reputation: 125

Module or Incorrect Python Version Problem?

I'm installing a bunch of python modules on my system that are specific to this code I am going to be working with. Specifically, I used pip install pyda to get the pyda module. To make sure I had gotten all the modules, I went through and ran some of the code snippets, and came across the following error: ModuleNotFoundError: No module named 'pyda.utilities'

I tried using pip install pyda.utilities, but that honestly doesn't make sense, it should have just come with the pyda module. According to this website https://pypi.org/project/pyda/ it seems like it should come with the package. I tried determining if I just installed it in the wrong python version, but I'm having a difficult time forcing it to use the specific python version that I installed the module in (specifically, I tried to create an alias for /usr/bin/python3.7 or something like this as I have seen on other websites, but it just fusses at me that this is simply a directory, incredibly unhelpful because I can't find the corresponding executable, so I'm a bit confused here).

This is a very long question likely with a very simple answer, any thoughts or help on what the issue might be would be appreciated.

Edit: I have determined that it's a package problem, not a python problem. The command 'pip install pyda' is not actually installing everything, oddly enough, which is why it cannot find the pyda.utilities module. Unfortunately, I think this means I will have to install the package manually. I will keep this question posted because of the useful answer on virtual environments, so thanks everyone.

Upvotes: 0

Views: 1270

Answers (2)

Grismar
Grismar

Reputation: 31319

The answer is indeed straightforward. As @Chris indicated in the comments, start using virtual environments.

It's not as complicated as it sounds and there's plenty of tutorials on getting started with virtualenv for Python, like https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/26/python-virtual-env/

The basic steps:

  • check you're using the version of Python you want in your virtual environment
  • if you don't, change directories to where it lives
  • ensure you have pip and it works
  • check if you have virtualenv and if you don't pip install virtualenv
  • create a virtual environment virtualenv /your/env/folder/here
  • activate the virtual environment with /your/env/folder/here/Scripts/activate

After that, just install the packages you need with pip and they will end up in your virtual environment, with no interference from other Python versions or packages.

Upvotes: 1

Nduka Junior
Nduka Junior

Reputation: 1

Check your python version, if it does not work restart your computer and try run setup.py install on the python command line

Upvotes: 0

Related Questions