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.
Related
I have an ImportError issue with my AWS Lambda function
I can run this code locally without ImportError
I use zappa serverless for uploading my code to AWS Lambda--which requires a virtual environment and is an end-to-end solution for creating and updating Lambda functions
I previously had this code working on AWS Lambda
I'm not sure of the change I made (#3) that made this code go from working to ImportError. The log output is as follows.
[ERROR] Runtime.ImportModuleError: Unable to import module 'dailycore': Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "/var/lang/bin/python3.8"
* The NumPy version is: "1.23.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
I'm unclear if this is a Numpy issue, a Python issue, or a Zappa issue. Two changes I made that may have had an impact:
I separated out some of my personal code, uploaded it to github, and installed it as packages within the virtual environment using pip
I uninstalled Python from my machine and reinstalled it--as I had two versions causing conflict. Upon my reinstallation (Python 3.8), I changed the installation directory from its default.
The code runs from VS Code locally and wholly contained from within the virtual environment (i.e. I don't have any packages installed via pip on my machine outside of virtual environments at this point). The suggestions above may or may apply to this error. I've tried adding a system PATH variable to my Python 3.8 directory. I've tried downgrading numpy to 1.23.0. I've tried uninstalling all dependencies within the virtual environment and reinstalling them.
UPDATE: I found this link and am looking into these comments: https://github.com/Miserlou/Zappa/issues/1222
UPDATE2: I deleted the virtual environment and re-created per a suggestion at the link above. This did not work.
UPDATE3: I think my issue relates to the private package dependencies I installed via pip from my personal github repos (#2-2). This link may be related. Something about dependencies not being at the top level. I am unsure how to fix this issue and/or repackage my private repo or install correctly. Any clarification is appreciated.
UPDATE4: I've isolated my issue to the private package dependencies and how they get called. A the solution may be related to Lambda Layers, tutorial here. Looking into this.
The ImportModuleError is related to this python package: alpha_vantage and not either of my initial theories. I am unsure as to why, though. It seems like it has something to do with Alpha Vantage's setup.py file; although I could be mistaken.
I have removed the reference to Alpha Vantage for now, but if anyone knows why installing this package would throw a numpy error, please elaborate. I think the only reference to numpy would be through the pandas package--which is only an optional install (i.e. extras_requires in setup.py)
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
Imagine the situation like below. There must be simple explanation.
I have a program written in Jupyter notebook and use Python 3.7. There is no errors while executing the program and works on two PC computers. As I remember there where just only Python 3.7 (and adds like matplotlib etc. all what is needed).
Then on the others computers where is Python 3.8 the same programs gives me an error. Why?
I took another two PC removed all Python installation and install 3.7 3.8 3.9 3.10 Python (tried every of them) and I can't execute the programs without error. Why is like that? All extensions like matplotlib, numpy , scipy which is needed every time are install in proper way by pip etc...Path in Windows are always correct.
It seems to me that on those two computer where program work fine was only Python 3.7 (but I am not sure in 100% that there hadn't been installed previous version of the Python) the programs works. Any other installation or refreshment of the Python makes that teh program gives me errors.
The only one what I should to do is 100% reset Windows and do fresh and the newest one Python instillation (Jupyther etc.) and check whether the error exist or not. But I would like to know what makes the problem and not to refresh all my Windows installation every time.
The problem is even more interesting when I am taking the same program
and put them to the virtual Jupyther using the Internet and browser they always work fine without any errors and there is for sure the news Python engine I guess not 3.7.
Did you try to execute "pip freeze" or "conda list" on these computers (with Ananconda Powershell for ex.) to verify that all the libraries' versions you are using are the same?
Looking at the error on the screenshot, I would bet that the problem does not come from your Python version but more from a higher version on matplotlib installed on the first two PCs, which makes that the third one (with potentially an older version of matplotlib) does not support the arguments given.
Just try executing:
(base) PS C:\XXX\Python> conda list matplotlib
and should get the version of matplotlib installed on each PC, like this:
# packages in environment at C:\XXX\Miniconda3:
#
# Name Version Build Channel
matplotlib 3.4.2 pypi_0 pypi
matplotlib-inline 0.1.2 pypi_0 pypi
If they are different, this might be where the issue comes from.
I use conda update --all to update my packages. Recently, I encountered an error with Anaconda build, posted at Error while trying to update and use scipy module in Anaconda. It seems now the issue has been fixed. Is there any way, I can test all modules one by one by importing them and deleting them ? I am requesting this because I have noticed that if import doesn't work, I spend a lot of time figuring out the dependency and then the package that is causing this. For instance, a few minutes ago I found that PyCharm 2018.2.4 breaks with the latest version of matplotlib (3.0.0). Hence, it might be helpful to run some type of test script after running conda update --all to ensure that all packages are indeed working--i.e. importable.
I did some research on this topic and found three sources.
First, Anaconda offers run_test.py (Source: https://conda.io/docs/user-guide/tasks/build-packages/recipe.html). However, being new to the world of Python, I am unsure how to go about running a script in Anaconda terminal.
Second, I found: https://conda.io/docs/user-guide/install/test-installation.html. However, this just tells me the version of the package. I am not interested in the version. I need to know whether all packages import properly.
Finally, I found out that there is a method to run test script for all packages at https://anaconda-installer.readthedocs.io/en/latest/testing.html. However, I am unsure how I can run make in Anaconda terminal. I used to use make long time ago when I worked on gcc on Unix environment. Being new to Python, I am unsure how to go about handling this.
I'd appreciate any thoughts or any test script that could help us verify two things:
a) whether all packages have been installed
b) packages are indeed importable; If the package import fails, the script should terminate with handsome error message highlighting the source (package) where import failed.
I've installed mesos 0.26 successfully on a vm machine.
The installation has been performed on an ubuntu trusty thar system
by following this manual:
https://open.mesosphere.com/getting-started/install/
So far so good. I wanted to write a tiny python framwork.
For this I need to install the eggs via easy_install:
(I've downloaded the eggs accordingly for the trusty thar ubuntu and the 0.26 mesos):
wget http://downloads.mesosphere.io/master/ubuntu/14.04/mesos-0.26.0-py2.7-linux-x86_64.egg
easy_install mesos-0.26.0-py2.7-linux-x86_64.egg
all went fine, however, if I start python in the shell
and type in
import mesos.interface
I get the message: ImportError: No module named interface
As someone suggested, it may be that there is no longer a binding for python, or that they have renamed the API calls. Well, I looked in the version updates here:
http://mesos.apache.org/documentation/latest/upgrades/
Since the transition from 0.19.x to 0.20.x there hasn't been any changes regarding the mesos.interface part, or at least they are not mentioning it here.
To increase the confusion I also get the following error message when I'm typing in python: import mesos.native
There I receive: ImportError: No module named interface.mesos_pb2. To put it into a nutshell: what is going wrong here, and how can it be fixed? And yes, I've googled various web pages, with terms such as "mesos python bindings", mesos +api +python, etc. And yes, I have also consulted the official mesos webpage. There are nice refences for Java and C++ but not for python, or at least they are very well hidden.
Thanks in advance for any hints.
Solved. For what reasons ever:
export PYTHONPATH=${PYTHONPATH}:/usr/lib/python2.7/site-packages/
is required to set the PYTHONPATH. After that step it works like a charm.