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

pip install ffcv error #60

Closed
geekchen007 opened this issue Jan 20, 2022 · 9 comments
Closed

pip install ffcv error #60

geekchen007 opened this issue Jan 20, 2022 · 9 comments

Comments

@geekchen007
Copy link

geekchen007 commented Jan 20, 2022

(ffcv) $ pip install ffcv
Collecting ffcv
Using cached ffcv-0.0.2.tar.gz (53 kB)
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /XXX/ffcv/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j9vpaf6i/ffcv_c2eb5c5207c34d81ac29a3ccddbb59fb/setup.py'"'"'; file='"'"'/tmp/pip-install-j9vpaf6i/ffcv_c2eb5c5207c34d81ac29a3ccddbb59fb/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-y1669tep
cwd: /tmp/pip-install-j9vpaf6i/ffcv_c2eb5c5207c34d81ac29a3ccddbb59fb/
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-j9vpaf6i/ffcv_c2eb5c5207c34d81ac29a3ccddbb59fb/setup.py", line 36, in
libffcv = Extension('ffcv._libffcv',
TypeError: keywords must be strings

WARNING: Discarding https://files.pythonhosted.org/packages/4f/55/9b06a72c29710110387c3af33eb1a9d6e5d9d5781d5b2850a3ad202942d2/ffcv-0.0.1.tar.gz#sha256=5246dbbbc0a3bcf788783d413292d8bede455a08ad0fa9c29736eca85b577b26 (from https://pypi.org/simple/ffcv/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement ffcv (from versions: 0.0.1, 0.0.2)
ERROR: No matching distribution found for ffcv_

@GuillaumeLeclerc
Copy link
Collaborator

Hello,

Did you follow the installation instructions ? It looks like you are either missing opencv4 or libturbojpeg

@geekchen007
Copy link
Author

I follow the installation instructions, opencv4 or libturbojpeg is ok.
(ffcv) $ pkg-config --cflags --libs opencv4
-I//anaconda3/envs/ffcv/include/opencv4 -L/data/chenkun/anaconda3/envs/ffcv/lib -lopencv_gapi -lopencv_stitching -lopencv_alphamat -lopencv_aruco -lopencv_barcode -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_cvv -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_highgui -lopencv_datasets -lopencv_text -lopencv_plot -lopencv_videostab -lopencv_videoio -lopencv_wechat_qrcode -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core

(ffcv)$ pkg-config --cflags --libs libturbojpeg

-I//anaconda3/envs/ffcv/include -L/data/chenkun/anaconda3/envs/ffcv/lib -lturbojpeg

@GuillaumeLeclerc
Copy link
Collaborator

That's a good start!

Could you run clone the repo and run python setup.py build and inspect what you get in the variable extension_kwargs ?

@geekchen007
Copy link
Author

geekchen007 commented Jan 20, 2022

Thanks to your promotion, I found a fix. Details are as follows:
The code of my Linux terminal is incorrect. When you run pkg-config --cflags --libs XXX, a message is displayed.
“bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf-8)” and extension_kwargs is read by mistake.

def pkgconfig(package, kw):
if flag_map.get(token[:2]):
kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
return kw

@GuillaumeLeclerc
Copy link
Collaborator

Great. Happy it worked for you. I'll close and feel free to open a new issue if you face a problem

@cod3r0k
Copy link

cod3r0k commented Jan 21, 2022

Do we just need to install it with conda? Can't we install it with pip and virtualenv? @GuillaumeLeclerc @geekchen007

@lykius
Copy link

lykius commented Jan 28, 2022

Here's how I managed to install ffcv with pip:

  • install opencv following these instructions, but adding the flag -DOPENCV_GENERATE_PKGCONFIG=ON when running cmake ../opencv-4.x
  • install libturbojpeg with sudo apt install libturbojpeg libturbojpeg-dev
  • pip install ffcv numba opencv-python

Hope it's helpful!

@GuillaumeLeclerc
Copy link
Collaborator

@cod3r0k No FFCV needs C++ libraries and pip only install python packages so you have to either install them:

  • through conda
  • compile them manually (@lykius did this for opencv)
  • with your OS package manager (@lykius did for libturbojpeg)

@netw0rkf10w
Copy link

Hi @GuillaumeLeclerc. Does FFCV use OpenCV's GPU modules or just CPU ones? I'm wondering if we could install OpenCV without its GPU modules. Thanks.

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

5 participants