dattalab / keypoint-moseq

https://keypoint-moseq.readthedocs.io
Other
64 stars 26 forks source link

Error installing jupyter notebook extensions #82

Closed ryanschwark closed 10 months ago

ryanschwark commented 11 months ago

Hello,

After installing the most recent version of Keypoint MoSeq using pip on our PC, we tried to install the Jupyter extensions from the terminal. For reference, our current operating system is Windows 11 Pro, version 21H2, OS build 22000.1696, and our processor is the 12th Gen Intel(R) Core(TM) i7-12700K (3.60 GHz), and we have 64.0 GB of installed RAM. Unfortunately when we do this we run into an error -- here's the command and resulting error message. We get this error if we use either the base or the keypoint_moseq environment. Any idea what the issue might be? Thanks!

(base) C:\Users\Abdus-saboor>conda activate keypoint_moseq (keypoint_moseq) C:\Users\Abdus-saboor>jupyter nbextension install --py jupyter_nbextensions_configurator --sys-prefix Traceback (most recent call last): File "C:\Users\Abdus-saboor\anaconda3\Scripts\jupyter-nbextension-script.py", line 10, in sys.exit(main()) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\jupyter_core\application.py", line 269, in launch_instance return super().launch_instance(argv=argv, **kwargs) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\traitlets\config\application.py", line 846, in launch_instance app.start() File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\notebook\nbextensions.py", line 972, in start super().start() File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\jupyter_core\application.py", line 258, in start self.subapp.start() File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\notebook\nbextensions.py", line 702, in start self.install_extensions() File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\notebook\nbextensions.py", line 675, in install_extensions full_dests = install(self.extra_args[0], File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\notebook\nbextensions.py", line 203, in install_nbextension_python m, nbexts = _get_nbextension_metadata(module) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\notebook\nbextensions.py", line 1107, in _get_nbextension_metadata m = import_item(module) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\traitlets\utils\importstring.py", line 38, in import_item return import(parts[0]) ModuleNotFoundError: No module named 'jupyter_nbextensions_configurator'

calebweinreb commented 11 months ago

What happens if you first run

conda install -c conda-forge jupyter_contrib_nbextensions
ryanschwark commented 11 months ago

So when we run that command in the base environment, there are lots of conflicts and it says that the current version installed is 0. So I'm guessing it didn't work? Here's the end portion of the readouts from the terminal:

Package _low_priority conflicts for: libarchive -> _low_priority python-libarchive-c -> libarchive -> _low_priority conda-build -> libarchive -> _low_priority

Package conda-package-streaming conflicts for: conda[version='>=22.9.0'] -> conda-package-handling[version='>=1.3.0'] -> conda-package-streaming[version='>=0.7.0|>=0.9.0'] anaconda-client -> conda-package-handling[version='>=1.7.3'] -> conda-package-streaming[version='>=0.7.0|>=0.9.0'] conda-build -> conda-index -> conda-package-streaming[version='>=0.7.0|>=0.9.0'] conda-verify -> conda-package-handling[version='>=1.0.4'] -> conda-package-streaming[version='>=0.7.0|>=0.9.0'] conda-package-handling -> conda-package-streaming[version='>=0.7.0|>=0.9.0']

Package h5py conflicts for: anaconda==2022.10=py39_0 -> h5py==3.7.0=py39h3de5c98_0 xarray -> h5netcdf -> h5py

Package m2-patch conflicts for: anaconda==2022.10=py39_0 -> m2-patch==2.7.5=2 conda-build -> m2-patch[version='>=2.6']The following specifications were found to be incompatible with your system:

Your installed version is: 0

Note that strict channel priority may have removed packages required for satisfiability.

calebweinreb commented 11 months ago

Can you run it in the keypoint_moseq env?

ryanschwark commented 11 months ago

Sure! If I run it in the keypoint_moseq environment, it looks like I'm still getting an error:

(keypoint_moseq) C:\Users\Abdus-saboor>conda install -c conda-forge jupyter_contrib_nbextensions Collecting package metadata (current_repodata.json): failed WARNING conda.exceptions:print_unexpected_error_report(1251): KeyError('pkgs_dirs') Traceback (most recent call last): File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\exceptions.py", line 1129, in call return func(*args, kwargs) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\cli\main.py", line 86, in main_subshell exit_code = do_call(args, p) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 93, in do_call return getattr(module, func_name)(args, parser) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\notices\core.py", line 72, in wrapper return_value = func(*args, *kwargs) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\cli\main_install.py", line 22, in execute install(args, parser, 'install') File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\cli\install.py", line 261, in install unlink_link_transaction = solver.solve_for_transaction( File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\solve.py", line 156, in solve_for_transaction unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier, File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\solve.py", line 199, in solve_for_diff final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned, File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\solve.py", line 304, in solve_final_state ssc = self._collect_all_metadata(ssc) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\common\io.py", line 86, in decorated return f(args, kwds) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\solve.py", line 467, in _collect_all_metadata index, r = self._prepare(prepared_specs) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\solve.py", line 1061, in _prepare reduced_index = get_reduced_index(self.prefix, self.channels, File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\index.py", line 301, in get_reduced_index new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs, File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 115, in query_all create_cache_dir() File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 737, in create_cache_dir cache_dir = join(PackageCacheData.first_writable().pkgs_dir, 'cache') File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 158, in first_writable pkgs_dirs = context.pkgs_dirs File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\base\context.py", line 555, in pkgs_dirs fixed_dirs += user_data_dir(APP_NAME, APP_NAME), File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda_vendor\appdirs.py", line 67, in user_data_dir path = os.path.join(_get_win_folder(const), appauthor, appname) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda_vendor\appdirs.py", line 265, in _get_win_folder_with_pywin32 from win32com.shell import shellcon, shell ImportError: DLL load failed while importing shell: The specified procedure could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\exceptions.py", line 1249, in print_unexpected_error_report message_builder.append(get_main_info_str(error_report['conda_info'])) File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\cli\main_info.py", line 237, in get_main_info_str infodict['' + key] = ('\n' + 26 * ' ').join(info_dict[key]) KeyError: 'pkgs_dirs'

>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

Traceback (most recent call last):
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\exceptions.py", line 1129, in __call__
    return func(*args, **kwargs)
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\cli\main.py", line 86, in main_subshell
    exit_code = do_call(args, p)
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 93, in do_call
    return getattr(module, func_name)(args, parser)
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\notices\core.py", line 72, in wrapper
    return_value = func(*args, **kwargs)
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\cli\main_install.py", line 22, in execute
    install(args, parser, 'install')
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\cli\install.py", line 261, in install
    unlink_link_transaction = solver.solve_for_transaction(
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\solve.py", line 156, in solve_for_transaction
    unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\solve.py", line 199, in solve_for_diff
    final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\solve.py", line 304, in solve_final_state
    ssc = self._collect_all_metadata(ssc)
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\common\io.py", line 86, in decorated
    return f(*args, **kwds)
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\solve.py", line 467, in _collect_all_metadata
    index, r = self._prepare(prepared_specs)
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\solve.py", line 1061, in _prepare
    reduced_index = get_reduced_index(self.prefix, self.channels,
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\index.py", line 301, in get_reduced_index
    new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 115, in query_all
    create_cache_dir()
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 737, in create_cache_dir
    cache_dir = join(PackageCacheData.first_writable().pkgs_dir, 'cache')
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\core\package_cache_data.py", line 158, in first_writable
    pkgs_dirs = context.pkgs_dirs
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\base\context.py", line 555, in pkgs_dirs
    fixed_dirs += user_data_dir(APP_NAME, APP_NAME),
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\_vendor\appdirs.py", line 67, in user_data_dir
    path = os.path.join(_get_win_folder(const), appauthor, appname)
  File "C:\Users\Abdus-saboor\anaconda3\lib\site-packages\conda\_vendor\appdirs.py", line 265, in _get_win_folder_with_pywin32
    from win32com.shell import shellcon, shell
ImportError: DLL load failed while importing shell: The specified procedure could not be found.

$ C:\Users\Abdus-saboor\anaconda3\Scripts\conda-script.py install -c conda-forge jupyter_contrib_nbextensions

environment variables: conda info could not be constructed. KeyError('pkgs_dirs')

An unexpected error has occurred. Conda has prepared the above report.

calebweinreb commented 11 months ago

Hmm seems like a conda issue: https://github.com/conda/conda/issues/11503

The linked thread suggests

pip install --upgrade pywin32==228

could help

ryanschwark commented 11 months ago

Thanks! I successfully ran the command "pip install --upgrade pywin32==228". After this, I ran the command "conda install -c conda-forge jupyter_contrib_nbextensions" and I'm not sure it worked. This is what happened:

(keypoint_moseq) C:\Users\Abdus-saboor>conda install -c conda-forge jupyter_contrib_nbextensions Collecting package metadata (current_repodata.json): done Solving environment: | The environment is inconsistent, please check the package plan carefully The following packages are causing the inconsistency:

==> WARNING: A newer version of conda exists. <== current version: 22.9.0 latest version: 23.7.2

Please update conda by running

$ conda update -n base -c defaults conda

Package Plan

environment location: C:\Users\Abdus-saboor\anaconda3\envs\keypoint_moseq

added / updated specs:

The following NEW packages will be INSTALLED:

ipython_genutils conda-forge/noarch::ipython_genutils-0.2.0-py_1 None jupyter_contrib_n~ conda-forge/noarch::jupyter_contrib_nbextensions-0.7.0-pyhd8ed1ab_0 None jupyter_highlight~ conda-forge/win-64::jupyter_highlight_selected_word-0.2.0-py39hcbf5309_1005 None jupyter_latex_envs conda-forge/noarch::jupyter_latex_envs-1.4.6-pyhd8ed1ab_1002 None libxslt conda-forge/win-64::libxslt-1.1.37-h6070c61_1 None lxml conda-forge/win-64::lxml-4.9.3-py39hbae3653_0 None nbconvert conda-forge/noarch::nbconvert-7.7.3-pyhd8ed1ab_0 None nbconvert-pandoc conda-forge/noarch::nbconvert-pandoc-7.7.3-pyhd8ed1ab_0 None pandoc conda-forge/win-64::pandoc-3.1.3-h57928b3_0 None pywin32 conda-forge/win-64::pywin32-304-py39h99910a6_2 None

Proceed ([y]/n)?

Preparing transaction: done Verifying transaction: done Executing transaction: \ Traceback (most recent call last): File "C:\Users\Abdus-saboor\anaconda3\envs\keypoint_moseq\lib\site-packages\jupyter_contrib_core\notebook_compat\nbextensions.py", line 6, in from notebook.extensions import BaseExtensionApp ModuleNotFoundError: No module named 'notebook.extensions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Abdus-saboor\anaconda3\envs\keypoint_moseq\lib\site-packages\jupyter_contrib_core\notebook_compat\nbextensions.py", line 10, in from notebook.nbextensions import BaseNBExtensionApp ModuleNotFoundError: No module named 'notebook.nbextensions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\Users\Abdus-saboor\anaconda3\envs\keypoint_moseq\lib\site-packages\jupyter_contrib_core\notebook_compat\nbextensions.py", line 12, in from ._compat.nbextensions import BaseNBExtensionApp File "C:\Users\Abdus-saboor\anaconda3\envs\keypoint_moseq\lib\site-packages\jupyter_contrib_core\notebook_compat_compat\nbextensions.py", line 35, in from notebook.nbextensions import ( ModuleNotFoundError: No module named 'notebook.nbextensions'

done ERROR conda.core.link:_execute(733): An error occurred while installing package 'conda-forge::jupyter_highlight_selected_word-0.2.0-py39hcbf5309_1005'. Rolling back transaction: done

LinkError: post-link script failed for package conda-forge::jupyter_highlight_selected_word-0.2.0-py39hcbf5309_1005 location of failed script: C:\Users\Abdus-saboor\anaconda3\envs\keypoint_moseq\Scripts.jupyter_highlight_selected_word-post-link.bat ==> script messages <== Traceback (most recent call last): File "C:\Users\Abdus-saboor\anaconda3\envs\keypoint_moseq\lib\site-packages\jupyter_contrib_core\notebook_compat\nbextensions.py", line 6, in from notebook.extensions import BaseExtensionApp ModuleNotFoundError: No module named 'notebook.extensions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Abdus-saboor\anaconda3\envs\keypoint_moseq\lib\site-packages\jupyter_contrib_core\notebook_compat\nbextensions.py", line 10, in from notebook.nbextensions import BaseNBExtensionApp ModuleNotFoundError: No module named 'notebook.nbextensions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\Users\Abdus-saboor\anaconda3\envs\keypoint_moseq\lib\site-packages\jupyter_contrib_core\notebook_compat\nbextensions.py", line 12, in from ._compat.nbextensions import BaseNBExtensionApp File "C:\Users\Abdus-saboor\anaconda3\envs\keypoint_moseq\lib\site-packages\jupyter_contrib_core\notebook_compat_compat\nbextensions.py", line 35, in from notebook.nbextensions import ( ModuleNotFoundError: No module named 'notebook.nbextensions'

==> script output <== stdout: stderr: return code: 1

()

calebweinreb commented 11 months ago

Try first running one of the following?

pip install -U notebook

or

conda install jupyter
ryanschwark commented 11 months ago

Thanks! Alright, so I tried both the "pip install -U notebook" command and the "conda install jupyter" command. After running either of these first, and then running the "conda install -c conda-forge jupyter_contrib_nbextensions" command, I still get the same error as before.

What should we try next?

calebweinreb commented 11 months ago

Hmm at this point it seems more of a conda/jupyter issue, so it might be worth googling and/or posting an issue there. But if you get completely stuck I'm happy to keep helping. Also if you do find a solution, it would helpful to post here for future reference!

calebweinreb commented 10 months ago

Closing this because it's old and we couldn't resolve it. We are releasing an update soon that makes these extensions optional.