Need help with Jupyter Notebook

Hi, I just started a course to learn about data analysis. So keep in mind I’m a complete beginner including on this website. The course told me to type this:

!pip install pandas==0.20.0
!pip install matplotlib==2.0.2
!pip install seaborn==0.7.1
!pip install plotly==2.4.1
!pip install cufflinks==0.12.1
!pip install scikit-learn==0.20.0
!pip install nltk==3.2.3

but i keep getting a long error, on the video he isnt getting the error but this video is much older.

here is the error:

error: subprocess-exited-with-error

python setup.py egg_info did not run successfully.
exit code: 1

[13 lines of output]
C:\ProgramData\Anaconda3\envs\DataScience_36\Lib\site-packages\setuptools_init_.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

      ********************************************************************************
      Requirements should be satisfied by a PEP 517 installer.
      If you are using pip, you can try `pip install --use-pep517`.
      ********************************************************************************

!!
dist.fetch_build_eggs(dist.setup_requires)
error in pandas setup command: ‘install_requires’ must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
pytz >= 2011k
~~~~~~~^
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Collecting matplotlib==2.0.2
Using cached matplotlib-2.0.2.tar.gz (53.9 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status ‘error’
error: subprocess-exited-with-error

python setup.py egg_info did not run successfully.
exit code: 1

[63 lines of output]

Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
matplotlib: yes [2.0.2]
python: yes [3.11.3 | packaged by Anaconda, Inc. | (main,
May 15 2023, 15:41:31) [MSC v.1916 64 bit (AMD64)]]
platform: yes [win32]

REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.24.3]
six: yes [using six version 1.16.0]
dateutil: yes [using dateutil version 2.8.2]
functools32: yes [Not required]
subprocess32: yes [Not required]
pytz: yes [using pytz version 2023.3]
cycler: yes [using cycler version 0.10.0]
tornado: yes [using tornado version 6.2]
pyparsing: yes [using pyparsing version 3.0.9]
libagg: yes [pkg-config information for ‘libagg’ could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype (ft2build.h)
could not be found. You may need to install the
development package.]
png: no [The C/C++ header for png (png.h) could not be
found. You may need to install the development
package.]
qhull: yes [pkg-config information for ‘qhull’ could not be
found. Using local copy.]

OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: no [skipping due to configuration]
toolkits_tests: no [skipping due to configuration]

OPTIONAL BACKEND EXTENSIONS
macosx: no [Mac OS-X only]
qt5agg: no [PyQt5 not found]
qt4agg: no [PySide not found; PyQt4 not found]
gtk3agg: no [Requires pygobject to be installed.]
gtk3cairo: no [Requires cairocffi or pycairo to be installed.]
gtkagg: no [Requires pygtk]
tkagg: yes [installing; run-time loading from Python Tcl /
Tk]
wxagg: no [requires wxPython]
gtk: no [Requires pygtk]
agg: yes [installing]
cairo: no [cairocffi or pycairo not found]
windowing: yes [installing]

OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: no
latex: no
pdftops: no

OPTIONAL PACKAGE DATA
dlls: no [skipping due to configuration]

============================================================================
* The following required packages can not be built:
* freetype, png
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Does anyone know what I should do? I’ve contacted the tutor for the course but apparently they take days to reply. I’m really desperate to get on with this course and I don’t want this error to interrupt my learning

That above indicates you are using Anaconda/conda as your main package manager. Because Anaconda/conda as your main package manager, you should primarily be using conda to install packages and only fall back to pip when absolutely necessary. So I don’t know if your class is giving you bad advice or you did something different than it suggested; however, I believe most of those packages install with conda and so that is what you should be using. Additionally, it has more power to act in your system and more complex installs often work with conda whereas they fail with pip.

So for the example on the first line if you search ‘anaconda pandas’ you’ll end up here and so one option for the proper command to run inside the notebook is %conda install -c anaconda pandas. However, don’t quite go running that yet. There is also the conda-forge channel and if you search ‘pandas conda-forge’ you’ll see the command is %conda install -c conda-forge pandas. You should probably read the highlight here, look for the other packages you need to see if they are also available on conda-forge as well, and decide which one is more in line with your class.

You may notice I’m using the current best practice of using a magic command. See here about the modern magic install commands that you can run inside notebooks so the installs occur in the environments where the kernel is running that is underlying the active notebook. If you course isn’t using that take some aspects with a critical eye. See the second paragraph here on why to avoid use of exclamation point with pip and conda installs. This is also why elsewhere here I question how current is what you are saying is being suggested.

Is there text that accompanies the video available? Consider videos get outdated very fast whereas text based versions that accompany videos can be updated much more easily and so maybe they updated that?


How recently did you install Anaconda/conda? If you are using something old on your system I recommend updating. We cannot see what triggered the issue you are pasting about because you haven’t pasted the part of the traceback that gives that information. For example, does the first line of your long list of commands cause that or the 6th line. The way you are doing things and posting here isn’t providing that information. And it isn’t a good way to troubleshoot. Break the problem down to see what works and what fails as you troubleshoot.

An important aspect to consider is the versions. I see you are having issues with matplotlib. I would suggest making a separate environment and trying installing the packages without specifying the versions and see how that goes.


Also you have tagged this with the ‘JupyterHub’ category. Is that accurate? The title and the post and lines you share suggest it isn’t; you appear not to be a JupyterHub.