3

enter image description hereI have a simple question. I have install resampy using anaconda

conda install -c conda-forge resampy

Now when I import resampy into my python program, it still returns the error saying Import Error: No module named resampy But conda says it is installed. Can someone help me out where I'm doing something wrong? The major confusion that I come across is: When I install a package using anaconda, does it install just like any other package installed via pip? Can I import and use it just like any other package?
Please someone help me out of this.

Tauseef_Ahmed
  • 343
  • 3
  • 8
  • 18
  • 1
    Most likely you have multiple versions of Python installed (for instance, from python.org and from Anaconda). In addition, you cannot activate conda environments in the Powershell terminal. – darthbith Jul 29 '17 at 14:56

2 Answers2

1

I have the same experience, somehow in the PATHs that Anaconda created, it does not include the full path to the package installed via conda install.

As workaround, i use:

import sys sys.append(full path to the site-package directory)

in my case: sys.path.append("C:/Users/rpo/AppData/Local/conda/conda/envs/tweet/Lib/site-packages/")

I experienced this for one package in both linux and windows conda environment, i guess could be package specific issue.

r poon
  • 633
  • 7
  • 7
0

I guess the best way to manage packages be it anaconda or plain python is to first create a virtual environment. Thereafter, all packages you install will be available to you when you activate this environment. Managing Python in this way keeps things easy and savvy and allows you to work with several versions of Python if you require.

Create a virtual environment

Specifying the version is optional.

conda create -n [env_name] python=[python_version]

Activate the virtual environment

source activate [env_name]

Install all your packages

You can now install either packages from anaconda. They will all be installed.

conda install [package_name(in this case resampy)]

And for the rest of your questions refer this: What is the difference between pip and conda?

For more on managing environment refer this: https://conda.io/docs/using/envs.html#

  • Is your motive achieved? Was my answer helpful –  Jul 29 '17 at 09:01
  • But I'm getting the same error. I created an environment for python 3.5.3, activated it then installed resampy. But when I run my python program (located at desktop) on python 3.5.3 IDE, it returns the same error saying no module named resampy. :/\ – Tauseef_Ahmed Jul 29 '17 at 09:02
  • Can you please attach the same error which you are getting!!! A screenshot of terminal –  Jul 29 '17 at 09:03