In Mozilla FireFox after pressing Ctrl-F3 the Jupyter Opens a search window in upper right corner instead of Mozilla's in bottom left corner

In Mozilla FireFox after pressing Ctrl-F3 the Jupyter Opens a search [Find] window in upper right corner instead the one of Mozilla’s in bottom left corner.

The bottom left corner window for searching the page opens only after pressing the Mozilla’s Topmost menu Edit/Find.

Not sure what you are seeking with this post?
What you show is Jupyter Notebook 7 that has advanced features and abilities. One of these is that it has a feature-reach find and replace tool that is now the default when you use the shortcut to open Find. It will be in the upper corner where you show it, here you can find a picture of the tool isolated.
This is meant as a feature and not a bug. You would expect the Jupyter tool to have priority when you are using Jupyter. You have found you can still access the native browser utility.
There’s other posts on here about adjusting the shortcuts that Jupyter uses if you want to perhaps switch this shortcut to a different combination. See here. That may allow you restore the direct line to the other find if that is how you prefer to work? I’m not sure how tunable this combination may be. But getting a better idea of what you looking for is a better way to go and may necessitate a different post or posting about this in a GitHub issues thread. There’s some pertinent discussion here.
And I know there is a discussion and associated GitHub’s issue page about fixing shortcuts that uses to be available or making them consistent with old Jupyter Notebook; however, I cannot find it right now.

@fomightez Thank you for your reply. My English is poor, so I apologize in advance. What I was seeking is the proper working of the left hand side bottom search field. It just finds 1 or 2 items where there are in fact 24 items matching the patter in the entire .ipynb file (page in Mozilla FF). It just cycles in between 1st and 2nd and never reaches 4 up to 24th item. How can I fix this bug ? Even if there is [*] the left hand side bottom search field won’t find it. I wish that it would go directly to the place where [*] is located as does my other environment. What should I upgrade/downgrade so that this feature works as expected ?

Thanks for the clarification.
One of the improved features should be finer control over how the Jupyter Find and Replace works. See here for some guidance on how you can adjust options. It should have an option to search through the whole document as someone was pointing out here.
If what is described there for how to adjust the scope of the search isn’t working, you may indeed have uncovered a bug.

I don’t know if it will allow what you want, however, you can still use NbClassic. See more about NbClassic in my answer here. It may allow you to access what you prefer more easily for now. Keep in mind though that is a branch of development that will not continue other than maintenance henceforth. And so you may want to start getting used to the newer tech before that branch is no longer useful as the components diverge too much and support for the infrastructure needed to keep that branch operating eventually becomes too much.

I have succeeded by downgrading notebook to 6.0 and it works now fine. However, I’m getting another bug:

I’m trying to run my GPU instead of CPU in Jupyter Notebook. My GPU works now. However, I’m getting an error as in the snippet below.I’ve tried virtually every to fix that h5py missing file bug, but I haven’t succeeded. That essentially means that in my activate envGPU4 I cannot run some code. I was reasoning along the lines that some h5py file overwrites that system one, but I’m unable to fix it.From Anaconda it does work somehow:

(C:\Users\Documents\myenvGPU4) C:\Users\Documents>python -c "import h5py; print(h5py.__file__)"
C:\Users\Documents\myenvGPU4\lib\site-packages\h5py\__init__.py

Gives this output:

C:\Users\Documents\myenvGPU4\lib\site-packages\h5py\__init__.py

and

 python -c "import h5py; print(h5py.__version__)"
 3.10.0

But not in the Jupyter Notebook!

enter image description here

EDIT
The initial code was like this:

import numpy as np
import tensorflow as tf
from tensorflow.keras.applications import MobileNetV2
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input, decode_predictions
from tensorflow.keras.preprocessing import image

# Load the pre-trained MobileNetV2 model
model = MobileNetV2(weights='imagenet', include_top=True)

# Load and preprocess an image
# Replace 'path/to/your/image.jpg' with the actual file path
img_path = 'path/to/your/image.jpg'
img = image.load_img(img_path, target_size=(224, 224))  # MobileNetV2 expects images of size 224x224
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)

# Make a prediction
predictions = model.predict(x)

# Decode and print the top-3 predicted classes
for _, pred_class, prob in decode_predictions(predictions, top=3)[0]:
    print(f"Predicted: {pred_class} with probability {prob}")

Good. Thanks for reporting back what fixed the issue featured in the title of this thread.

Technically, the rest of your most recent post isn’t related to the topic of this thread, however…
What do you see in Jupyter if you run import h5py and then run dir(h5py)?

I see this:

['AttributeManager',
 'Dataset',
 'Datatype',
 'Empty',
 'ExternalLink',
 'File',
 'Group',
 'HLObject',
 'HardLink',
 'MultiBlockSlice',
 'Reference',
 'RegionReference',
 'SoftLink',
 'UNLIMITED',
 'VirtualLayout',
 'VirtualSource',
 '__builtins__',
 '__cached__',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__spec__',
 '__version__',
 '_conv',
 '_errors',
 '_hl',
 '_objects',
 '_proxy',
 '_register_converters',
 '_register_lzf',
 '_selector',
 '_unregister_converters',
 '_warn',
 'atexit',
 'check_dtype',
 'check_enum_dtype',
 'check_opaque_dtype',
 'check_ref_dtype',
 'check_string_dtype',
 'check_vlen_dtype',
 'defs',
 'enable_ipython_completer',
 'enum_dtype',
 'filters',
 'get_config',
 'h5',
 'h5a',
 'h5ac',
 'h5d',
 'h5ds',
 'h5f',
 'h5fd',
 'h5g',
 'h5i',
 'h5l',
 'h5o',
 'h5p',
 'h5pl',
 'h5py_warnings',
 'h5r',
 'h5s',
 'h5t',
 'h5z',
 'is_hdf5',
 'opaque_dtype',
 'ref_dtype',
 'regionref_dtype',
 'register_driver',
 'registered_drivers',
 'run_tests',
 'special_dtype',
 'string_dtype',
 'unregister_driver',
 'utils',
 'version',
 'vlen_dtype']

If you do not see anything like that, is it possible you have another file named h5py along your path and it is interfering with accessing the proper one, which you suggest as the possible cause yourself. However you don’t seem to provide any troubleshooting along those lines. What do you get if you put h5py?? on a cell and run it. And then compare what it says for File there to output for import inspect; inspect.getfile(h5py) where you run print(h5py.__version__) and it works.

A very illuminating hint. I can see by the two your commands this:
(BTW is that correct and if not, how can I fix it ??)

1

import h5py

2

dir(h5py)

['__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__spec__']

I wasn’t done editing and posted a bit early (see the bottom). Essentially you want to look at what __file__ would give. You should be able to just put h5py?? on a cell and run it. Or maybe more clearly the following as a cell you run on its own:

h5py??

As for fixing it, remove the erroneous interferring package and run the install again from inside your notebook, %pip install h5py as a cell in your notebook. (That I’d be %conda install -c conda-forge h5py if you are using Anaconda/conda, which I I didn’t think you were.)

Can you guess from any of the 2 above images what is wrong with my h5py and esp. how can I fix it ?

Nope. Your environment seems messed up there. My understanding is you will see this about frozen when the bytecode is not connected to the source for some reason.
Can you make a new environment elsewhere in your system for working in a Jupyter and try installing h5py again?

h5py works with Jupyter Notebook >=7.0
But then, Ctrl-F in my Mozilla FF is broken and doesn’t search up what is definitely on the html page.
So I cannot use JN >=7.0 for this reason.

The find issue seems much less to overcome then the h5py package not working. Can’t you search elsewhere or use a different browser?

The possibility of not searching correctly is yet more annoying than not working h5py :frowning:
Yes I can search in my other environment with JN 6.0.

Bingo: my h5py now runs smoothly. The problem was that I was executing h5py from another environment than was the current one. But this raises another question, how do I make priority to execute C:\Users\Documents\myenvGPU4\lib\ more greedily (i.e. first) than C:\Users\Documents\myenvGPU3\lib\. This didn’t solve the problem:

import sys

# Directory you want to add
directory_to_prepend = ''C:\Users\Documents\myenvGPU4\lib\"

# Prepend the directory to sys.path
sys.path.insert(0, directory_to_prepend)

# Verify the change (optional)
print(sys.path)
1 Like

Please update your related StackOverflow post, too. (Ideally, you’d link that StackOverflow post back here, too, since it was the original impetus. I’ve linked to it from here via this post.)

You may want to open another post somewhere about this current issue. I fear what you are trying to do is so removed from the topic here that even if it gets answered here, it won’t do any favors for anyone encountering a similar issue.

BTW, h5py?? as run from a cell in Jupyter Notebook prints still the old environment though in other cells it works fine:
And yes, I’ve obtained my new myenvGPU6 by cloning it within Anaconda interface. I’m unable to understand what’s going on here.


Type:        module
String form: <module 'h5py' from 'C:\\Users\\Documents\\myenvGPU3\\lib\\site-packages\\h5py\\__init__.py'>
File:        c:\users\documents\myenvgpu3\lib\site-packages\h5py\__init__.py
Source:     
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License:  Standard 3-clause BSD; see "license.txt" for full license terms
#           and contributor agreement.

"""
    This is the h5py package, a Python interface to the HDF5
    scientific data format.
"""

from warnings import warn as _warn
import atexit


# --- Library setup -----------------------------------------------------------

# When importing from the root of the unpacked tarball or git checkout,
# Python sees the "h5py" source directory and tries to load it, which fails.
# We tried working around this by using "package_dir" but that breaks Cython.
try:
    from . import _errors
except ImportError:
    import os.path as _op
    if _op.exists(_op.join(_op.dirname(__file__), '..', 'setup.py')):
        raise ImportError("You cannot import h5py from inside the install directory.\nChange to another directory first.")
    else:
        raise

from . import version

if version.hdf5_version_tuple != version.hdf5_built_version_tuple:
    _warn(("h5py is running against HDF5 {0} when it was built against {1}, "
           "this may cause problems").format(
            '{0}.{1}.{2}'.format(*version.hdf5_version_tuple),
            '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple)
    ))


_errors.silence_errors()

from ._conv import register_converters as _register_converters, \
                   unregister_converters as _unregister_converters
_register_converters()
atexit.register(_unregister_converters)

from .h5z import _register_lzf
_register_lzf()


# --- Public API --------------------------------------------------------------

from . import h5a, h5d, h5ds, h5f, h5fd, h5g, h5r, h5s, h5t, h5p, h5z, h5pl

from ._hl import filters
from ._hl.base import is_hdf5, HLObject, Empty
from ._hl.files import (
    File,
    register_driver,
    unregister_driver,
    registered_drivers,
)
from ._hl.group import Group, SoftLink, ExternalLink, HardLink
from ._hl.dataset import Dataset
from ._hl.datatype import Datatype
from ._hl.attrs import AttributeManager
from ._hl.vds import VirtualSource, VirtualLayout

from ._selector import MultiBlockSlice
from .h5 import get_config
from .h5r import Reference, RegionReference
from .h5t import (special_dtype, check_dtype,
    vlen_dtype, string_dtype, enum_dtype, ref_dtype, regionref_dtype,
    opaque_dtype,
    check_vlen_dtype, check_string_dtype, check_enum_dtype, check_ref_dtype,
    check_opaque_dtype,
)
from .h5s import UNLIMITED

from .version import version as __version__


def run_tests(args=''):
    """Run tests with pytest and returns the exit status as an int.
    """
    # Lazy-loading of tests package to avoid strong dependency on test
    # requirements, e.g. pytest
    from .tests import run_tests
    return run_tests(args)


def enable_ipython_completer():
    """ Call this from an interactive IPython session to enable tab-completion
    of group and attribute names.
    """
    import sys
    if 'IPython' in sys.modules:
        ip_running = False
        try:
            from IPython.core.interactiveshell import InteractiveShell
            ip_running = InteractiveShell.initialized()
        except ImportError:
            # support <ipython-0.11
            from IPython import ipapi as _ipapi
            ip_running = _ipapi.get() is not None
        except Exception:
            pass
        if ip_running:
            from . import ipy_completer
            return ipy_completer.load_ipython_extension()

    raise RuntimeError('Completer must be enabled in active ipython session')
1 Like