Pip Install Unable to Find Ffi.H Even Though It Recognizes Libffi

PIP install unable to find ffi.h even though it recognizes libffi

You can use CFLAGS (and LDFLAGS or various other compiler and linker options) in front of the pip command (ditto for setup.py):

Something similar to the following should work:

CFLAGS=-I/usr/include/libffi/include pip install pyOpenSSL

Exception using pip install

It appears you don't have libffi-dev installed:

sudo apt-get install libffi-dev

Should install the package with the missing header.

If this is a fresh server then you could also opt to install some of the more common dev packages at once:

sudo apt-get install libffi-dev libssl-dev libxml2-dev libxslt1-dev libncurses5-sdev

Error installing jupyterlab/jupyter notebook on MacOS big sur

Not sure what's going on with the built in version of python in OS X (I've heard something about compatibility switching causing unpredictable behaviour as it switches between 2 modes automatically).

Anyway, it seems installing the homebrew version of python largely skips around the issues so I suggest you go that route.

Install brew if not installed

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 

Install brew version of python

brew install python 

Add an alias to your shell (the below command is for zshell) to make python point to your new python install

echo "alias python=/usr/local/bin/python3" >> ~/.zshrc

Setup a virtual environment to sequester off where you install packages to

python -m venv ~/.env

Activate the virtual environment

source ~/.env/bin/activate

Install packages to your environment

pip install notebook jupyter

Retry loop fails to find newly created file even though it is there

The problem is with your use of glob.glob(). It will only return files that already exist. If none of the matching files exist when you start, glob.glob() won't return anything, and filepath will still be set to the wildcard. os.path.isfile() doesn't do wildcard matching, so it will never succeed.

You need to call glob.glob() in the retry loop, not before the loop.

max_retries = 4
time.sleep(1)
for _ in range(max_retries):
files = glob.glob(filepath):
if len(files) > 0:
filepath = files[-1]
print("File found: " + filepath)
break
time.sleep(3)
else:
print("File not found")


Related Topics



Leave a reply



Submit