I was wondering if you have used the library "trimesh" in python. It looks quite useful, but right now im having some trouble with the method "Trimesh.spli()" on the last line of the code attached. the code was working fine up to that line, which is suppose to return a list of trimesh objects.
However, when I try to run this code, I get the error ImportError: no graph engines available!
Do you know how can I set up a graph engine? or if there is any turnaround this issue?
Thanks for your support,
Regards
import numpy as np
import trimesh
# Load the stl files into the script
mesh = trimesh.load('Path_to_STL_file')
mesh2 = trimesh.load('Path_to_raw_material_in_STL')
# Confirm both files are closed
assert mesh.is_watertight
assert mesh2.is_watertight
#Boolean operation
mesh3 = trimesh.Trimesh.difference(mesh2,mesh)
list_mesh = trimesh.Trimesh.split(mesh3)
I found the issue. The library does not install all dependancies unless you ask for it. Usually, it only requires numpy.
One option to install most of the dependancies is:
pip install trimesh[easy]
or, if that doesn't solve it, you could use:
pip install trimesh[all]
You need to also install either scipy or networkx to satisfy the graph engine dependency. There's a comment in the source code that networkx is 5-10 times slower than scipy so it's probably best to install scipy. If you're using pip then it's
pip install scipy
or if you're using conda:
conda install scipy
Related
I have some python code which uses function scipy.integrate.simpson
So for example I import scipy using import scipy.integrate as scp_int and then use it in following way:
vol_r = scp_int.simpson(f_integrand_r,dx=_dx1,axis=0)
I get this error
vol_r = scp_int.simpson(f_integrand_r,dx=_dx1,axis=0)
AttributeError: module 'scipy.integrate' has no attribute 'simpson'`
I have made sure that I have scipy package installed, using pip install scipy, and I have restarted computer. I don't know why is this happening? Can someone give the reason or help me solve this issue?
I suspect you are using version 1.5 (or an older version) of SciPy.
If you don't know which version you have installed, you can check with
import scipy
print(scipy.__version__)
simpson was added in 1.6.0; it is the new name for the old function called simps. If you can't upgrade, you should be able to use simps instead of simpson.
I try to inititialize HDBSCAN for clustering in JupytherLab. I use Python 3.7.6..
import numpy as np
import pandas as pd
from sklearn.datasets import load_digits
from sklearn.manifold import TSNE
import hdbscan
There always always appears the same error (see headline) and until now I do not know, from what exactly it comes from.
I have looked in several post after solutions, but no solution has helped me until yet.
For example:
uninstalled and installed numpy.
installed numpy >= 1.20.0
tried lines like pip install package --no-cache-dir --no-binary :all:
tried following package version combination: hdbscan=0.8.19, matplotlib=3.2.2, numpy=1.15.4, pandas=0.23.4, scikit-learn=0.20.1, scipy=1.1.0, tensorflow=1.13.1.
I have also tried to install packages like tensorboard, but it did not helped. Everything is installed via the Terminal and with pip.
I start to think, that the problem might be deeper - but maybe I overlooked something important.
Can somebody help me to find the bug, please?
Best regards
Philipp
I guess you've probably seen this very long HDBSCAN GitHub issue where there still doesn't seem to be a clear solution. Unfortunately it seems to affect different systems in weird ways and there is a huge list of possible solutions and things that worked for other people (personally, just reinstalling numpy worked for me when I had a similar problem last week.)
The fact that you can try so many things and still have it not work seems suspicious. Maybe something else about your Python install or the way you're trying them is affecting the solutions? For instance, is JupyterLab definitely using the same Python environment that you're trying these solutions on? (You could test this by uninstalling HDBSCAN and seeing if the error changes instead to "package not found.")
Other than the many solutions in the GitHub issue (which it sounds like you've already tried), I really don't think there's much else you can try other than freshly reinstalling Python. Something about NumPy 1.20 and a change to the C API is causing this issue and it could be that something is lurking in your install every time you try these solutions.
Alternatively, you could make a new Python install/environment with a tool like pyenv or anaconda so that it doesn't break your existing install, and you can try and install just the bare minimum on this new install (i.e. just HDBSCAN.)
Upgrading the numpy library solved the problem.
My numpy version is 1.22.0 and sklearn version is 0.24.1.
you should also look here: ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
I'm working on a web application using Dash, and I would like to use arules and aruleViz from R within a python script to get a graph of association rules obtained by using an Aprioi algorithm.
I found the rpy2 package and I installed it using conda conda install rpy2 ,then I try to import some packages like base tools by:
from rpy2.robjects.packages import importr`
arules = importr("tools",)`
That was fine(the package was imported)
And when I use: arules = importr("arules",) or arules = importr("arulesViz",)
I got receive the following error:
RRuntimeError: Error in loadNamespace(name) : there is no package called ‘arulesViz’
I saw an option in the importrpackage (lib_loc=None). I'm not sure how can I change it.
If there is any way to solve this, or if you know of a package in python that will help me plot a graph with vertices (I know how to so that with matplot.lib library using scatter but i'm not happy with it) I would greatly appreciate the help!
Thank you!
R packages must be installed before rpy2 can hope to find them. rpy2's importr() relies on R's own package loading system.
If you are certain to have installed that package earlier, you might have installed it in different directory, in a previous R process, and your current R process does not know about that directory. The optional named argument lib_loc accepts the path to that directory (see the doc).
(Note that there is also a utility function to check if an R package is installed without loading it)
I am using the Python module called PRECESSION to model the inspiral of binary black holes. As it states in the linked paper, to use the function "Sb_limits" requires the use of scipy.optimize.brentq
However, it seems that my system is not able to download/install scipy.optimize.brentq for some reason(s) that I do not understand. Specifically, as the attached image shows, I receive these errors in the cmd prompt:
ERROR: Could not find a version that satisfies the requirement
scipy.optimize.brentq (from versions: none)
ERROR: No matching distribution found for scipy.optimize.brentq
No one appears to have posted this issue already, although I'm probably missing something basic. I'm not sure if I can just create the scipy.optimize.brentq module myself using the source code here (seems like I'd be trying too hard!)??
My problem seems deeper than just "you need to install scipy" ............
Since I have already installed it and brentq is nowhere to be found:
You just need to install scipy:
pip install scipy
then you can call brentq method inside your code:
import scipy.optimze as so
so.brentq(...arg)
Description
scipy is a package that aims to help scientist to use python for their research, it has some subpackages that each one does special things. for example optimize designed for optimizations. linalg do some algebra.
if you want to use sub packages in python you have to import them explicitly. so the following code doesn't work.
import scipy
scipy.optimize.brentq
trying to import scipy.interpolate but it can’t import _fblas.pyd. It keeps throwing the following error
File "C:\cygwin64\lib\python2.7\site-packages\scipy/linalg/blas.py", line 155, in <module>
from scipy.linalg import _fblas
ImportError: cannot import name _fblas
My online research suggested that this is because I had the wrong version of numpy installed, and I need to install numpy+mkl. So I uninstalled the version I had and pip installed numpy 1.10.4, which includes mkl.
This did not fix the original problem with _flbas.pyd.
I would reinstall scipy but I can't remember where I got the version I have, and when I pip install scipy 0.17.1.tar.gz it throws an error saying that it has no blas resources, which are necessary. I've also tried to download it from here: https://github.com/scipy/scipy/releases, but they don't include _fblas.pyd in the first place.
I’m not sure where to go from here. I'm not even entirely sure why it won't import the _fblas.pyd file.
This looks like you tried to manually comply to your needed packages. Even though I take my hat off at your effort, keep in mind that this is not an simple task at all.
I might also add that this kind of work is not meant for a developer ("the person who writes the code"), but a full time maintainer. Specially with your particular Cygwin environment
So, what can you do? Alternatively, you can use one of Continuum's mkl-ready python-and-many-tools-including-mkl+scipy distribution or Enthought's Canopy. Hopefully, this will avoid you lots of hours of staring at the screen wondering what's wrong