rasbt/watermark

Fail to import watermark to jupyter notebook - anaconda (py36 env)

quarrazzella opened this issue · 8 comments

Hi there!

After successfully installing watermark via pip install watermark to both anaconda environments (py27 and py36), I'm struggling with a strange issue.

While I can easily import it using py27 environment (it works perfectly in jupyter notebook python 2), I can't import it using py36 environment (see screenshot). What could be the reason for it? Thanks!

screen shot 2018-02-10 at 18 26 55

I can see it's been installed properly (as far as I can see)
screen shot 2018-02-10 at 18 39 46

rasbt commented

Hi,

hm this looks strange, indeed! It could be unrelated to watermark, and it could be that you are using a Jupyter installation that is not specific to the environments. I remember that I had general issues with that some time ago; I think the solution was to install jupyter notebook for the specific environment as well.

In any case, I would maybe recommend just executing the following command in the Jupyter notebook first, to check which python executable your Jupyter notebook is using (i.e., if it is using the "general" anaconda3 one, it wouldn't look for modules in anaconda3/envs/some_env):

import sys
sys.executable

Let me know what you find!

screen shot 2018-02-10 at 22 08 43

Hm, looks like the issue is solved. I just checked it, works fine. I haven't changed a thing.

rasbt commented

Oh, nice! Glad that the issue solved itself :)

Hello. I am facing a similar issue as the one discussed above.

Watermark works with iPython as well as within my IDE in a Conda3.9 environment (called dlf here), but kills my kernel when I run it in Jupyter. Watermark works with JupyterLab and Python 3.11 on my system, but not with Python 3.9.

Version Details and a MWE (from my iPython console):

Python 3.9.0 (default, Nov 15 2020, 06:25:35) 
Type 'copyright', 'credits' or 'license' for more information
IPython 8.15.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: load_ext watermark
In [2]: watermark -v -p jupyterlab,numpy,pandas,matplotlib,scikit-learn --conda

Python implementation: CPython
Python version       : 3.9.0
IPython version      : 8.15.0

jupyterlab  : 4.0.5
numpy       : 1.25.2
pandas      : 2.0.3
matplotlib  : 3.7.2
scikit-learn: 1.2.2

conda environment: dlf

When I run the same 2 lines to load and run watermark on Jupyterlab, I get a warning that my kernel was killed and will automatically restart.

Is there a compatibility issue that is causing this? Thank you for this great tool.

Edit: added the word "here" in para2 to avoid ambiguity

rasbt commented

Thanks for reporting this, and this sounds weird. Haven't encountered anything like that before.

Could you perhaps try it in a more minimal way like

%load_ext watermark
%watermark -p numpy,pandas

and see if it occurs then too?

Thanks for this. I did not run into this issue without the flag.

It seems that Jupyter required more memory for me to run Watermark with the --conda flag than without. So I simply changed the RAM allocation to 1GB, which did the trick!

rasbt commented

Huh, that's super weird. There maybe seems to be an issue with conda then. I haven't encountered this myself, yet, but I will keep an eye on it! Thanks for reporting!