Skip to main content
Solved

install package 'cognite' for following Data Engineer Basics - Learn course


Forum|alt.badge.img+3

Hello!

 

I am trying to follow along the Data Engineer Learn module. There are hands on exercises that needs me to install jupyter notebook - i used pip to do that. In the notebook 1_Authentication.ipynb, the package cognite is needed:

from cognite.client.credentials import OAuthInteractive
from cognite.client import CogniteClient, ClientConfig

returns the error

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[5], line 10
      1 ## !pip3 install cognite
      2 ## !pip3 show cognite-sdk
      3 ## !pip3 show cognite-sdk
   (...)
      8 #import cognite.client
      9 #from cognite.client import CogniteClient
---> 10 from cognite.client.credentials import OAuthInteractive
     11 from cognite.client import CogniteClient, ClientConfig

ModuleNotFoundError: No module named 'cognite.client'

 

I am able to install cognite using pip to version 0.04. However poetry add cognite in the ‘using-python-sdk’ directory returned an error: 

  at ~/Library/Application Support/pypoetry/venv/lib/python3.12/site-packages/poetry/installation/chef.py:164 in _prepare
      160161│                 error = ChefBuildError("\n\n".join(message_parts))
      162163if error is not None:
    → 164raise error from None
      165166return path
      167168def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pyzmq (25.0.2) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "pyzmq (==25.0.2)"'.

The Poetry project has renamed the master branch to main. The use of the master branch is now deprecated and the branch will be removed in the near future. Please update your refs to use main branch instead. Alternatively consider using released versions.

How do I troubleshoot the “ModuleNotFoundError”, so I can successfully run the notebooks and follow along the course. I have been struck in this for 3 days now. kindly help.

Best answer by Lavanya Kannan

@Andrian Gasper I tried “pip install cognite-sdk” last night out of desperation (before seeing your response) and magically it worked. Prior to this I had tied a bunch of things - installing with pip3, poetry. I think I had run 

 

pip wheel --no-cache-dir --use-pep517 "pyzmq (==25.0.2)"

(think a lot of users mentioned this dependency not picked by poetry somehow?!)

to install “cognite” successfully in the meantime and this made

 

pip install cognite-sdk

or

poetry add cognite-sdk

run successfully.

View original
Did this topic help you find an answer to your question?

2 replies

Andrian Gasper
Practitioner
Forum|alt.badge.img+2

Hi @Lavanya Kannan 

You should use “cognite-sdk” not simply “cognite”.
Meaning, either “pip install cognite-sdk”, or “poetry add cognite-sdk”

Also if you are in the root directory (where the pyproject.toml file is) you should also be able to just write “poetry install”

Let me know how it goes.
 


Forum|alt.badge.img+3
  • Author
  • Active
  • 6 replies
  • Answer
  • April 12, 2024

@Andrian Gasper I tried “pip install cognite-sdk” last night out of desperation (before seeing your response) and magically it worked. Prior to this I had tied a bunch of things - installing with pip3, poetry. I think I had run 

 

pip wheel --no-cache-dir --use-pep517 "pyzmq (==25.0.2)"

(think a lot of users mentioned this dependency not picked by poetry somehow?!)

to install “cognite” successfully in the meantime and this made

 

pip install cognite-sdk

or

poetry add cognite-sdk

run successfully.


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings