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.
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.
Try re-running pip install -r requirements.txt. It looks like it might not have completed successfully
Related
I have a question regarding h5pyViewer to view h5 files. I tried pip install h5pyViewer but that didn't work. I checked on Google and it states that h5pyViewer does not work for older versions of Python, but that there are a few solutions on GitHub. I downloaded this with pip install git+https://github.com/Eothred/h5pyViewer.git which finally gave me a successful installation.
Yet, when I want to import the package with import h5pyViewer it gave me the following error: ModuleNotFoundError: No module named 'h5pyViewer'. However when I tried to install it again it says:
Requirement already satisfied: h5pyviewer in c:\users\celin\anaconda3\lib\site-packages (-v0.0.1.15)Note: you may need to restart the kernel to use updated packages.
Any ideas how to get out of this loop or in what other way I could access an .h5 file?
There could be so many things wrong so it's hard to say what the problem is.
The actual package import has a lowercase "v": h5pyviewer (as seen in your error message).
Your IDE/python runner may not be using your Conda environment (you can select the environment in VSCode, and if you are running a script in the terminal make sure your Conda env is enabled in that terminal)
The GitHub package might be exported from somewhere else. Try something like from Eothred import h5pyviewer.
Maybe h5pyviewer is not even supposed to be imported this way!
Overall, I don't suggest using this package, it seems like it's broken on Python 3 and not well maintained. The code in GitHub looks sketchy, and very few people use it. A good indicator is usually the number of people that star or use the package, which seems extremely low. Additionally, it doesn't even have a real readme file! It doesn't say how to use it at all. Suggest you try something else like pandas. But if you really want to go with this, you can try the above debugging steps.
I have a VERY LONG script including the function "ox.distance.get_nearest_edge".
When I run it under my local computer with osmnx version 1.1.1, I get a warning that the function is deprecated and may be removed in a future release. I now need to let the script run on a server, I installed osmnx, but the script does'nt work anymore even though I installed the same version (1.1.1). (I also took care that python, geopandas, networkx etc were the same).
The error message I get is "AttributeError: 'osmnx.distance' has no attribute 'get_nearest_edge'"
(I tried to use the new function from osmnx instead (ox.distance.nearest_edges), but it seems to work very differently, and I run into errors trying to adapt my (long) script correcly).
Make old functions work would be a good way to keep old scripts working. But why is the funktion not becoming available again when I install the old osmnx-package with all of its dependencies? Do I have to install even older package versions of osmnx? I use anaconda package controlling, and JupyterLab to run my script (just in case that is a relevant detail).
Re-verify the version you're running in your script. The get_nearest_nodes and get_nearest_edges functions were deprecated in v1.1 but not removed until the release of v1.2. If you do want to use a newer version, you can take advantage of the much faster and more flexible nearest_nodes and nearest_edges functions that replaced them. See the docs and usage examples for details and demonstrations.
I am trying to run the example found in the README of the PyLSCI package. It references a module util, so I am trying to install that through Conda, but it is not working. I have tried typing conda install util into the Anaconda Prompt, but I get an error that says:
PackagesNotFoundError: The following packages are not available from current channels
How can I install this module?
Additional Details
Windows OS
Anaconda Python distribution
There is no such "util" package. Seems like a classic grad-ware pattern: an old example is shown in the README.md referencing a local util.py file, that is kept in the release even though it is no longer relevant. Please file an issue on the GitHub repository to ask the author to update the documentation.
The mentioned util.py package is only used for the demo.ipynb, and it is exemplarly for any custom logic that is required to convert your speckle data to NumPy arrays, which is out of scope of PyLSCI.
See this GitHub issue for details, where I clearified this with Briget
The PyLSCI package itself doesn't rely on the mentioned util.py to work properly, as long as you provide the speckle data as NumPy arrays.
To make that more evident, I renamed the module to my_utils.py, and moved it with the demo.ipynb notebook to the binder directory of the repo, also see the latest release notes for further changes.
When I use pip to install a package from source, it will generates a version number for the package which I can see using 'pip show '. But I can't find out how that version number is generated and I can't find the version string from the source code. Can someone tell me how the version is generated?
The version number that pip uses comes from the setup.py (if you pip install a file, directory, repo, etc.) and/or the information in the PyPI index (if you pip install a package name). (Since these two must be identical, it doesn't really matter which.)
It's recommended that packages make the same string available as a __version__ attribute on their top-level module/package(s) at runtime that they put in their setup, but that isn't required, and not every package does.
And if the package doesn't expose its version, there's really no way for you to get it. (Well, unless you want to grub through the pip data trying to figure out which package owns a module and then get its version.)
Here's an example:
In the source code for bs4 (BeautifulSoup4), the setup.py file has this line:
version = "4.3.2",
That's the version that's used, directly or indirectly, by pip.
Then, inside bs4/__init__.py, there's this line:
__version__ = "4.3.2"
That means that Leonard Richardson is a nice guy who follows the recommendations, so I can import bs4; print(bs4.__version__) and get back the same version string that pip show beautifulsoup4 gives me.
But, as you can see, they're two completely different strings in completely different files. If he wasn't nice, they could be totally different, or the second one could be missing, or named something different.
The OpenStack people came up with a nifty library named PBR that helps you manage version numbers. You can read the linked doc page for the full details, but the basic idea is that it either generates the whole version number for you out of git, or verifies your specified version number (in the metadata section of setup.cfg) and appends the dev build number out of git. (This relies on you using Semantic Versioning in your git repo.)
Instead of specifying the version number in code, tools such as setuptools-scm may use tags from version control. Sometimes the magic is not directly visible. For example PyScaffold uses it, but in the project's root folder's __init__.py one may just see:
import pkg_resources
try:
__version__ = pkg_resources.get_distribution(__name__).version
except:
__version__ = "unknown"
If, for example, the highest version tag in Git is 6.10.0, then pip install -e . will generate a local version number such as 6.10.0.post0.dev23+ngc376c3c (c376c3c being the short hash of the last commit) or 6.10.0.post0.dev23+ngc376c3c.dirty (if it has uncommitted changes).
For more complicated strings such as 4.0.0rc1, they are usually hand edited in the PKG-INFO file. Such as:
# cat ./<package-name>.egg-info/PKG-INFO
...
Version: 4.0.0rc1
...
This make it unfeasible to obtain it from within any python code.
My employer has a dedicated module1 we use for internal unit / system test; however, the author of this module no longer works here and I have been asked to test some devices with it.
The problem is that pyfoo requires an ancient version of twisted (v8.2.0) and it imports twisted in 33 different files. I tried running pyfoo's unit tests under v11.0.0 and I don't even see TCP SYN packets2. Unfortunately, I have already got twisted v11.0.0 installed on my lab linux server and I have my own code that depends on it.
To solve this problem, I have only come up with the following options:
Option A. Install a new version of python, install virtualenv, and then install an old version of twisted under the virtualenv. Only run the tests requiring pyfoo under this new version of python.
Option B. Edit all 33 of the files with the following: DIR = '../'; sys.path.insert(0, DIR) and install the old version of python in the appropriate directory below the source.
Option C. Attempt to fix pyfoo to use v11.0.03
Are there any options I am missing? Is there a more elegant way to solve this problem, besides Option A, above?
**END-NOTES:**
Let's call it pyfoo for sake of argument
The unit tests connect to one of our local lab servers and exercises basic telnet functionality
This option is almost a non-starter... pyfoo is not trivial, and I have a short deadline for this work.
A better version of option B. would be to replace
import twisted
by
import pkg_resources
pkg_resources.require("Twisted==8.2.0")
import twisted
which will arrange for the correct version of twisted to be imported, so long as it's installed, and raises an exception otherwise. This is a more portable solution.
This won't work, though (nor would any other variaton of option B), if twisted gets imported before the pkg_resources.require gets called; twisted will already be in sys.modules
OP Edit: Minor syntax correction, per pkg_resources docs
If SingleNegationElimination's solution doesn't work, be aware that you don't need to replace all 33 instances of the import; you only need to modify sys.path at the entry points; e.g. you could target just your module's __init__.py files.
There you would insert e.g.
import sys
sys.path.insert(0, DIR)
I can't tell you what is best in your situation, but you might be able to consider:
Option D: run it in a virtual machine (eg. with Windows 7)
Option E: install old version of python/twisted on another machine
It took me a bit of trial and error to fix my situation; which involved the accepted answer and it's additional comments (mentioning adding _requires_)
__requires__= 'twisted==8.2.0'
import pkg_resources
pkg_resources.require("twisted==8.2.0")
import twisted
You should do uninstall and install before import.
First,
!pip uninstall igraph -y
!pip uninstall python-igraph -y
!pip install python-igraph==0.9.6
!pip install cairocffi
Then,
import igraph
print(igraph.__version__)
% 0.9.6