Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error installing required packages and building book #15

Closed
Kaiyiccc opened this issue Jan 25, 2022 · 7 comments
Closed

Error installing required packages and building book #15

Kaiyiccc opened this issue Jan 25, 2022 · 7 comments

Comments

@Kaiyiccc
Copy link

Hi, running into a few problems trying to set up the theme:

Conda version: 4.11.0

conda create --name cb --file environment.yml gives:
CondaValueError: could not parse 'name: cb' in: environment.yml

Seems like the command should be conda env create -n cb --file environment.yml:

  • the code in the README is missing env
  • the "name" flag should be passed with only one dash '-'

Running the modified command, I still get:

Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound: 
  - sqlite==3.36.0=hc218d9a_0
  - perl==5.20.3.1=2
  - ld_impl_linux-64==2.35.1=h7274673_9
  - ca-certificates==2021.5.30=ha878542_0
  - xorg-libxt==1.2.1=h7f98852_2
  - libiconv==1.16=h516909a_0
  - mkl_fft==1.3.0=py38h42c9631_2
  - libxcb==1.14=h7b6447c_0
  - openssl==1.1.1l=h7f98852_0
  - libglib==2.68.3=h3e27bee_0
  - giflib==5.2.1=h36c2ea0_2
  - ncurses==6.2=he6710b0_1
  - gdk-pixbuf==2.42.6=h04a7f16_0
  - numexpr==2.7.3=py38h22e1b3c_1
  - xorg-libxext==1.3.4=h7f98852_1
  - readline==8.1=h27cfd23_0
  - qt==5.9.7=h5867ecd_1
  - latexmk==4.55=pl5.20.3_0
  - cycler==0.10.0=py38_0
  - xz==5.2.5=h7b6447c_0
  - numpy-base==1.20.3=py38h74d4b33_0
  - scikit-learn==0.24.2=py38ha9443f7_0
  - tornado==6.1=py38h27cfd23_0
  - harfbuzz==2.4.0=h37c48d4_1
  - pixman==0.38.0=h516909a_1003
  - lz4-c==1.9.3=h295c915_1
  - gobject-introspection==1.68.0=py38h2109141_1
  - glib-tools==2.68.3=h9c3ff4c_0
  - librsvg==2.50.3=hfa39831_1
  - libgcc-ng==11.1.0=hc902ee8_8
  - fribidi==1.0.10=h36c2ea0_0
  - libgfortran4==7.5.0=ha8ba4b0_17
  - zlib==1.2.11=h7b6447c_3
  - pkg-config==0.29.2=h36c2ea0_1008
  - sip==4.19.13=py38he6710b0_0
  - scipy==1.6.2=py38had2a1c9_1
  - matplotlib-base==3.4.2=py38hab158f2_0
  - libffi==3.3=he6710b0_2
  - zstd==1.4.9=haebb681_0
  - xorg-libsm==1.2.2=h470a237_5
  - xorg-kbproto==1.0.7=h7f98852_1002
  - gst-plugins-base==1.14.0=h8213a91_2
  - libgomp==11.1.0=hc902ee8_8
  - pandas==1.3.2=py38h8c16a72_0
  - libxml2==2.9.12=h03d6c58_0
  - glib==2.68.3=h9c3ff4c_0
  - lcms2==2.12=h3be6417_0
  - freetype==2.10.4=h5ab3b9f_0
  - kiwisolver==1.3.1=py38h2531618_0
  - jbig==2.1=h7f98852_2003
  - graphviz==2.42.3=h0511662_0
  - imagemagick==7.0.11_12=pl5320h0cb4662_0
  - python==3.8.11=h12debd9_0_cpython
  - gettext==0.19.8.1=h0b5b191_1005
  - libstdcxx-ng==9.3.0=hd4cf53a_17
  - libtool==2.4.6=h58526e2_1007
  - pip==21.0.1=py38h06a4308_0
  - xorg-libice==1.0.10=h7f98852_0
  - xorg-libxpm==3.5.13=h7f98852_0
  - expat==2.4.1=h2531618_2
  - cairo==1.16.0=h18b612c_1001
  - xorg-xproto==7.0.31=h7f98852_1007
  - bzip2==1.0.8=h7f98852_4
  - bottleneck==1.3.2=py38heb32a55_1
  - fftw==3.3.9=h27cfd23_1
  - icu==58.2=he6710b0_3
  - graphite2==1.3.13=h58526e2_1001
  - libuuid==1.0.3=h1bed415_2
  - pyqt==5.9.2=py38h05f1152_4
  - libpng==1.6.37=hbc83047_0
  - pango==1.42.4=h7062337_4
  - _openmp_mutex==4.5=1_gnu
  - pcre==8.45=h295c915_0
  - openjpeg==2.4.0=hb52868f_1
  - brotli==1.0.9=he6710b0_2
  - gstreamer==1.14.0=h28cd5cc_2
  - libwebp-base==1.2.0=h27cfd23_0
  - jpeg==9d=h36c2ea0_0
  - matplotlib==3.4.2=py38h06a4308_0
  - libwebp==1.2.0=h3452ae3_0
  - mkl_random==1.2.2=py38h51133e4_0
  - xorg-libx11==1.7.2=h7f98852_0
  - xorg-libxrender==0.9.10=h7f98852_1003
  - fontconfig==2.13.1=h6c09931_0
  - pillow==8.3.1=py38h2c7a002_0
  - xorg-xextproto==7.3.0=h7f98852_1002
  - libtiff==4.2.0=h85742a9_0
  - certifi==2021.5.30=py38h578d9bd_0
  - _libgcc_mutex==0.1=conda_forge
  - mkl-service==2.4.0=py38h7f8727e_0
  - libgfortran-ng==7.5.0=ha8ba4b0_17
  - ghostscript==9.54.0=h9c3ff4c_1
  - intel-openmp==2021.3.0=h06a4308_3350
  - blas==1.0=mkl
  - mkl==2021.3.0=h06a4308_520
  - dbus==1.13.18=hb2f20db_0
  - tk==8.6.10=hbc83047_0
  - xorg-renderproto==0.11.1=h7f98852_1002
  - numpy==1.20.3=py38hf144106_0

And when I try to build the jupyter book this is the error:

Running Jupyter-Book v0.12.1
Source Folder: /Users/k/codebook
Config Path: /Users/k/codebook/_config.yml
Output Path: /Users/k/codebook/_build/html
Running Sphinx v4.3.1

Extension error:
Could not import extension sphinxext.opengraph (exception: No module named 'sphinxext')
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sphinx/registry.py", line 429, in load_extension
    mod = import_module(extname)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sphinxext'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_book/sphinx.py", line 114, in build_sphinx
    app = Sphinx(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sphinx/application.py", line 237, in __init__
    self.setup_extension(extension)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sphinx/application.py", line 394, in setup_extension
    self.registry.load_extension(self, extname)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sphinx/registry.py", line 432, in load_extension
    raise ExtensionError(__('Could not import extension %s') % extname,
sphinx.errors.ExtensionError: Could not import extension sphinxext.opengraph (exception: No module named 'sphinxext')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/bin/jupyter-book", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_book/cli/main.py", line 323, in build
    builder_specific_actions(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_book/cli/main.py", line 535, in builder_specific_actions
    raise RuntimeError(_message_box(msg, color="red", doprint=False)) from result
RuntimeError: 
===============================================================================

There was an error in building your book. Look above for the cause.

===============================================================================

Any idea what's wrong? Thank you!

@patrickmineault
Copy link
Owner

I fixed the build instructions and simplified the environment, it should be easier to resolve now. Pull the latest commit and let me know how it goes.

@LinasNas
Copy link

Hi, thanks for the update! At least in my case, it didn't fully resolve all the problems. As an FYI, I am using an M1 MacBook with Big Sur 11.6.

Once I downloaded the updated version of the repo and executed the command conda create --name cb --file environment.yml, the output was:

Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound: 
  - _openmp_mutex=4.5
  - libxcb=1.14
  - libgfortran-ng=7.5.0
  - libgcc-ng=11.1.0
  - libgomp=11.1.0
  - libstdcxx-ng=9.3.0

Once this method failed, I also tried to import the environment.yml file directly through Anaconda Navigator as one of the environments. However, I got the same error.

I also decided to try my luck by deleting these packages and running the same command again. This time, the error was different - it was related to package conflicts. For each package, the error message was of the form:

Package setuptools conflicts for:
seaborn=0.11.2 -> matplotlib[version='>=2.2'] -> setuptools[version='pandas=1.3.2 -> setuptools[version='matplotlib=3.4.2 -> matplotlib-base[version='>=3.4.2, setuptools
pandas=1.3.2 -> numexpr[version='>=2.7.0'] -> setuptools
scikit-learn=0.24.2 -> joblib[version='>=0.11'] -> setuptools
numexpr=2.7.3 -> setuptools
pip=21.0.1 -> setuptools
matplotlib-base=3.4.2 -> setuptools
python=3.8.11 -> pip -> setuptools
joblib=1.0.1 -> setuptools

Would you have any advice on what could be done in this case?

Thanks in advance!

@patrickmineault
Copy link
Owner

@LinasNas @Kaiyiccc How about now? 1c4c117

@LinasNas
Copy link

LinasNas commented Feb 1, 2022

Unfortunately, the error persists. Here are the steps I've taken, which may help you to reproduce it:

  1. Create new conda environment (Python 3.8 or Python 3.9)
  2. run the command pip install jupyter-book
  3. go to the codebook directory and run the command conda env create -n cb --file environment.yml

The error that I get is that many packages have conflict with others. One example package conflict is:

xorg-libxrender=0.9.10 -> xorg-libx11[version='1.6.*|>=1.7.0,<2.0a0']
xorg-libxpm=3.5.13 -> xorg-libx11[version='1.6.*|>=1.7.0,<2.0a0']
xorg-libxext=1.3.4 -> xorg-libx11[version='1.6.*|>=1.7.0,<2.0a0']
imagemagick=7.0.11_12 -> xorg-libxext -> xorg-libx11[version='1.6.*|>=1.7.0,<2.0a0']
xorg-libx11=1.7.2
xorg-libxt=1.2.1 -> xorg-libx11[version='1.6.*|>=1.7.0,<2.0a0']
imagemagick=7.0.11_12 -> xorg-libx11

Part of the problem may be that the environment.yml file doesn't specify the version of Python, and the version of conda that you have used on your local machine.

As an alternative to the process of building the environment with conda, have you thought about generating a requirements.txt file with all the necessary packages that the users could install?

Here is one solution that worked in my case:

  1. From theenvironment.yml file, I copied all the packages under the pip key, and pasted them into a newly-created requirements.txt file.
  2. I then created a new virtual environment with the command python3 -m venv cb.
  3. Due to package conflicts, I had to make one modification to the requirements.txt file: I had to delete the black library, because it was causing package conflicts with click and sphinx-external-toc that I couldn't resolve. You can find the final version of the requirements.txt below.
  4. I was able to successfully install all packages by running: pip install -r requirements.txt (note: the process was slow, because the packages didn't have their versions specified, so pip had to install a few different versions in some cases)
  5. I was able to successfully build the Jupyter book by running: jupyter-book build .

This is only a suggestion, as there are probably many reasons why you chose the method of using conda environments. But I thought it would be helpful to provide an alternative way which seems to work relatively well. As I've mentioned, this alternative installation process would be easier if each package had a version specified next to it.

The contents of requirements.txt file:

git+https://github.com/patrickmineault/sphinx-book-theme.git
alabaster
anyio
argon2-cffi
arrow
attrs
babel
backcall
backports-entry-points-selectable
beautifulsoup4
binaryornot
bleach
cffi
cfgv
chardet
charset-normalizer
click
colorama
cookiecutter
debugpy
decorator
defusedxml
deprecated
distlib
docutils
entrypoints
filelock
future
gitdb
gitpython
greenlet
identify
idna
imagesize
importlib-metadata
importlib-resources
iniconfig
ipykernel
ipython
ipython-genutils
ipywidgets
jedi
jinja2
jinja2-time
jsonschema
jupyter-book
jupyter-cache
jupyter-client
jupyter-core
jupyter-server
jupyter-server-mathjax
jupyter-sphinx
jupyterlab-widgets
jupytext
latexcodec
linkify-it-py
markdown-it-py
markupsafe
matplotlib-inline
mdit-py-plugins
mistune
mypy-extensions
myst-nb
myst-parser
nbclient
nbconvert
nbdime
nbformat
nest-asyncio
nodeenv
notebook
openreview-py
packaging
pandocfilters
parso
pathspec
pexpect
pickleshare
platformdirs
pluggy
poyo
pre-commit
prometheus-client
prompt-toolkit
ptyprocess
py
pybtex
pybtex-docutils
pycparser
pycryptodome
pygments
pyjwt
pylatexenc
pyrsistent
pytest
python-slugify
pyyaml
pyzmq
requests
requests-unixsocket
send2trash
setuptools
smmap
sniffio
snowballstemmer
soupsieve
sphinx
sphinx-comments
sphinx-copybutton
sphinx-external-toc
sphinx-jupyterbook-latex
sphinx-multitoc-numbering
sphinx-panels
sphinx-thebe
sphinx-togglebutton
sphinxcontrib-applehelp
sphinxcontrib-bibtex
sphinxcontrib-devhelp
sphinxcontrib-htmlhelp
sphinxcontrib-jsmath
sphinxcontrib-qthelp
sphinxcontrib-serializinghtml
sphinxext-opengraph
sqlalchemy
terminado
testpath
text-unidecode
tld
toml
tomli
tox
tqdm
traitlets
typing-extensions
uc-micro-py
urllib3
virtualenv
wcwidth
webencodings
websocket-client
widgetsnbextension
wrapt
zipp

@patrickmineault
Copy link
Owner

Okay, I have made a new, minimalistic environment.yml, and I tested it in Ubuntu and Windows. Does it work for you?

@LinasNas
Copy link

Yes, this time it works without any problem! Thanks for dedicating the time to fix this :)

@patrickmineault
Copy link
Owner

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants