2

On Windows, open up Anaconda Prompt and type in the following:

pip install json2xml

No complaints from pip for doing this (replace json2xml with your favorite package, I guess). Then, open up Jupyter QTConsole, and try:

import json2xml

The result is an ImportError: No module named 'json2xml'. The package installed (after checking pip list), but nothing recognizes it. There is no system pip (this is Windows, after all); only Anaconda's pip is being used.

What's going on?

cgmil
  • 410
  • 2
  • 18
  • Are you sure Jupyter is using the same Anaconda Python? Is that the only Python you have installed? – numbermaniac May 11 '17 at 07:41
  • It should be. I'm able to call up that specific version of `pip` and tell it to install the package, and it will say the package has already been installed, yet nothing can see it. I do have a Python 2.7 environment installed, and I think there's another Python install on my computer somewhere, but I doubt that's what's being called when I use `pip`. – cgmil May 11 '17 at 08:10
  • Hmm..sometimes, you need to use `pip3`, because `pip` might be tied to that 2.7. If `pip3 install json2xml` works, do you get importing success then? – numbermaniac May 11 '17 at 08:15
  • No, in fact, `pip3` doesn't seem to be a thing; there's only one `pip` that works only for Python 3 (which is the only Python recognized as installed). The `pip3` command works, but it does nothing different; it still says the package is already installed. – cgmil May 12 '17 at 00:28

2 Answers2

1

I hope this will help, it worked for me.
When you use pip to install a package, by default it will go to your python site-packages. i. e.

C:\Users\YOUR-USER-NAME\AppData\Local\Programs\Python\Python37-32\Lib\site-packages

From here, you can copy the downloaded packages, then navigate and paste them into your Anaconda site-packages directory. i. e.

C:\Anaconda\Lib\site-packages

That should solve the issue.

dkb
  • 4,389
  • 4
  • 36
  • 54
0

From How do I find the location of my Python site-packages directory? , you can enter

python -m site

to print your python package location(s). In my case, I have Anaconda for Windows and do not have a directory C:\Users\YOUR-USER-NAME\AppData\Local\Programs\Python\Python37-32\Lib\site-packages but did find my package installed with pip was in C:\Users\YOUR-USER-NAME\AppData\Local\Continuum\anaconda3\Lib\site-packages\ . This may be due to adding Anaconda to PATH.