IBM Support

How to install python package from local directory by using pip command

Question & Answer


Question

To install confluent-kafka-2.0.2 library, I downloaded the confluent-kafka-2.0.2.tar.gz package into "project_data/data_asset" directory and use following customization setting to create custom runtime environment template.
channels:
  -defaults
#dependencies:
# Remove the # on the following lines and replace sample package name with your package name.
  - pip install confluent_kafka == 2.0.2
However, when I use that template to create a new notebook, following error occurred:
image-20230302103337-1
I also tried to install confluent-kafka-2.0.2 by using following pip command in the notebook cell:
!pip install -find-links=/project_data/data_asset confluent-kafka-2.0.2.tar.gz
And I got following error:
Looking in links: ind-links=/project_data/data_asset
Processing ./confluent-kafka-2.0.2.tar.gz
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: confluent-kafka
  Building wheel for confluent-kafka (setup.py) ... error
  error: subprocess-exited-with-error
...
      gcc -pthread -B /opt/conda/envs/Python-3.9/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /opt/conda/envs/Python-3.9/include -I/opt/conda/envs/Python-3.9/include -fPIC -O2 -isystem /opt/conda/envs/Python-3.9/include -fPIC -I/opt/conda/envs/Python-3.9/include/python3.9 -c /tmp/1000680000/pip-req-build-b94qoct1/src/confluent_kafka/src/Admin.c -o build/temp.linux-x86_64-cpython-39/tmp/1000680000/pip-req-build-b94qoct1/src/confluent_kafka/src/Admin.o
      In file included from /tmp/1000680000/pip-req-build-b94qoct1/src/confluent_kafka/src/Admin.c:17:
      /tmp/1000680000/pip-req-build-b94qoct1/src/confluent_kafka/src/confluent_kafka.h:23:10: fatal error: librdkafka/rdkafka.h: No such file or directory
       #include <librdkafka/rdkafka.h>
                ^~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> confluent-kafka

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Let me know how to create custom runtime environment with confluent-kafka-2.0.2 installed on air-gap environment?


[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSGU851","label":"IBM Watson Studio for IBM Cloud Pak for Data"},"ARM Category":[{"code":"a8m50000000ClWMAA0","label":"Analyze-\u003EEnvironments"}],"ARM Case Number":"TS012301523","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

More support for:
IBM Watson Studio for IBM Cloud Pak for Data

Component:
Analyze->Environments

Software version:
All Versions

Document number:
6959541

Modified date:
01 March 2023

UID

ibm16959541

Manage My Notification Subscriptions