duo-labs / cloudmapper

CloudMapper helps you analyze your Amazon Web Services (AWS) environments.
BSD 3-Clause "New" or "Revised" License
5.94k stars 800 forks source link

pip install of requirements.txt failing for python 3.9 #803

Closed BenDenney closed 2 years ago

BenDenney commented 3 years ago

Steps taken:

  1. Git cloned repo, installed pre-reqs via brew for Mac.
  2. Git pull to get the latest requirements.txt file (with new pandas version).
  3. Activated venv as per instructions.
  4. Ran pip install requirements.txt.

Error encountered when building Matplotlib 3.2.2.

UPDATING build/lib.macosx-10.14-x86_64-3.9/matplotlib/_version.py
    set build/lib.macosx-10.14-x86_64-3.9/matplotlib/_version.py to '3.2.2'
    running build_ext
    IMPORTANT WARNING:
        pkg-config is not installed.
        Matplotlib may not be able to find some of its dependencies.
    building 'matplotlib.ft2font' extension
    creating build/temp.macosx-10.14-x86_64-3.9
    creating build/temp.macosx-10.14-x86_64-3.9/src
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -I/Users/denneyb/CloudMapper/cloudmapper/venv/lib/python3.9/site-packages/numpy/core/include -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/Users/denneyb/CloudMapper/cloudmapper/venv/include -I/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/checkdep_freetype2.c -o build/temp.macosx-10.14-x86_64-3.9/src/checkdep_freetype2.o
    src/checkdep_freetype2.c:3:6: error: "FreeType version 2.3 or higher is required. You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib download it."
        #error "FreeType version 2.3 or higher is required. \
astroid==2.4.1
         ^
    src/checkdep_freetype2.c:9:10: fatal error: 'ft2build.h' file not found
    #include <ft2build.h>
             ^~~~~~~~~~~~
    2 errors generated.
    error: command '/usr/bin/clang' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/denneyb/CloudMapper/cloudmapper/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/03/lqvrnsdj6r731xw6__n4ncr80ffzg2/T/pip-install-dnz2pqix/matplotlib/setup.py'"'"'; __file__='"'"'/private/var/folders/03/lqvrnsdj6r731xw6__n4ncr80ffzg2/T/pip-install-dnz2pqix/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/03/lqvrnsdj6r731xw6__n4ncr80ffzg2/T/pip-record-hd8wf_i5/install-record.txt --single-version-externally-managed --compile --install-headers /Users/denneyb/CloudMapper/cloudmapper/venv/include/site/python3.9/matplotlib Check the logs for full command output.

I attempted to fix by changing the requirements.txt to use Matplotlib==3.3.3, and running pip install again. This allowed the install to succeed, and I have successfully used now.

This seems to be a fix for python 3.9 users: as a first-time contributor do you want me to test this, or submit a PR? Happy to do it 👍

MaryOmotayo commented 3 years ago

Wow!! thanks alot I have been struggling to find a workaround this issue but your solution definitely resolved my issue.

w0rmr1d3r commented 3 years ago

Fixing this in https://github.com/duo-labs/cloudmapper/pull/847 using @BenDenney solution

cixelsyd commented 3 years ago

I was able to fix this by also installing freetype along with all the other brew install ... dependencies.

w0rmr1d3r commented 3 years ago

Hello @cixelsyd ! This PR -> https://github.com/duo-labs/cloudmapper/pull/840 Fixes cloudmapper the same way you did :)

w0rmr1d3r commented 2 years ago

Hello! I believe this issue can be closed, since the PR fixing it has been merged. Cheers!