Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: cannot import name 'mesh'

I am trying to create and save an stl file with a cube and I cannot import the mesh module for some reason. When hovering over mesh, it says: "Cannot find 'mesh' in '__init__.py'" I originally had the directory folder named stlExperiments but then someone said you cannot have stl in the name so I changed all instances of "stl" to "st" and no change, so I'm left to assume it's a completely different problem. Can anybody help? I am in the dark. The import code goes as follows:

from __future__ import absolute_import, division, print_function

import numpy as np
from stl import mesh

and the error message goes as follows:

Traceback (most recent call last): File "C:/Users/Riley/PycharmProjects/stExperiments/stCube.py", line 4, in from stl import mesh ImportError: cannot import name 'mesh'

Process finished with exit code 1

like image 885
Riley Fitzpatrick Avatar asked Oct 20 '25 03:10

Riley Fitzpatrick


1 Answers

I had the same problem when installing stl with pip install stl

Try using pip install numpy-stl

It works on my computer (Windows 10)

NOTE:

if you are on python 3.x, simply change pip to pip3

like image 114
lsabi Avatar answered Oct 22 '25 05:10

lsabi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!