Cannot import name 'isin' python

I wanted to make a deep learning model to run on my PC, but while it’s downloading it stops, because of the error message cannot import name 'isin' from 'jax._src.numpy.lax_numpy'

I have numpy and jax installed but it still gives me this error message. Is there any package I missed.(and some more)

Edit:

The dalle-flow-server https://github.com/jina-ai/dalle-flow and after writing jina flow --uses flow.yml it trys to execute a file and download a pre trained model and while it's doing that --> the Error appears.

2 answers

  • answered 2022-05-04 12:41 jakevdp

    The version 0.3.5 release of JAX rearranged some of the private implementation, and isin is no longer part of the private jax._src.numpy.lax_numpy submodule.

    Regardless of which JAX version you are using, the recommended import is

    from jax.numpy import isin
    

    This will work correctly in any JAX version released in the last several years since the isin function was first added.

    In general, you should avoid imports from any private submodule like jax._src.numpy (i.e. those starting with an underscore) because the contents may be subject to change in any release without warning. For public submodules like jax.numpy, any such changes will come with deprecation warnings for several releases before the imports are moved. See JAX's API Compatibility Policy for more information.

    If you are using a third party package that depends on private submodule imports, you may need to pin a particular jax & jaxlib version for it to work correctly. In this case it looks like you'll need the following:

    $ pip install jax==0.3.4 jaxlib==0.3.2
    

    You may wish to report this issue to the maintainers of dalle-flow, and suggest that they no longer rely on imports from private submodules.

  • answered 2022-05-04 23:17 joel

    Try re-running pip install -r requirements.txt. It looks like it might not have completed successfully

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum