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
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
Related
I wanted to plot a graph. but suddenly i could not because of the import error. yet i have installed matplotlib and numpy.
Traceback (most recent call last):
File "c:\Users\user\Documents\plot.py", line 1, in
from matplotlib import pyplot as plt
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib_init_.py", line 109, in
from . import _api, _version, cbook, docstring, rcsetup
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\rcsetup.py", line 27, in
from matplotlib.colors import Colormap, is_color_like
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\colors.py", line 56, in
from matplotlib import _api, cbook, scale
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\scale.py", line 23, in
from matplotlib.ticker import (
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\ticker.py", line 136, in
from matplotlib import transforms as mtransforms
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\transforms.py", line 46, in
from matplotlib._path import (
ImportError: DLL load failed while importing _path: The specified module could not be found.
PS C:\Users\user\Documents>
I figured it out.
If you have already installed matplotlib, but the error still comes about. Then you have to download Microsoft C++ from their website.
https://www.microsoft.com/en-US/Download/confirmation.aspx?id=48145
install Microsoft c++ then you can try again to run your code.
it has worked for me like magic.
I got the solution from a youtube video.
link here.
https://www.youtube.com/watch?v=DpwsvUkNAmg
Im getting below error while importing pandas
cannot import name 'nosetester'
Traceback (most recent call last):
File "/usr/bin/anaconda/envs/py35/lib/python3.5/site-packages/pandas/init.py", line 56, in
from pandas.util.nosetester import NoseTester
File "/usr/bin/anaconda/envs/py35/lib/python3.5/site-packages/pandas/util/nosetester.py", line 13, in
from numpy.testing import nosetester
ImportError: cannot import name 'nosetester'
Pandas version ->0.18.1
Numpy version ->1.18.0
Any help to resolve the error?
One approach is to use python 3.6 version like 3.6.5 is a stable version.
Another approach is if you want to continue in python 3.5 version itself then python 3.5.2 it worked correctly.
I'm trying to import a scikit-learn module
from sklearn.model_selection import train_test_split
and receive the error message
File "C:\Software\Anaconda\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py", line 45, in <module>
from . import _arpack
ImportError: DLL load failed: The specified procedure could not be found.
I'm not the first person to encounter this issue
(Error when trying to import sklearn modules : ImportError: DLL load failed: The specified module could not be found)
but neither of the remedies suggested in that discussion
uninstall/reinstall scipy
modify the fixes.py file
solved my problem. Any new ideas would be appreciated.
This question is related to the already asked question:
Julia error using PyPlot - signal (11): Segmentation fault
However, it is not entirely clear to me what the solution there was, or whether even the steps there apply also to my case (I tried them with no effect).
I have been using Julia 4.6 for some time without any problems.
I then decided to update my Ubuntu distribution from 14 to 16.04.
This is when PyPlot stopped working.
I have updated the Julia Packages, and I also did Pkg.build("PyPlot") to no effect. I also run Pkg.test("PyCall") and it passes all tests succesfuly. I also tried the suggestion
ENV["PYTHON"] = ""; Pkg.build("PyPlot")
The situation right now is the following.
I can import PyPLot normally:
using PyPlot
This gives me no errors.
However, as soon as I invoke any command relating to PyPlot, like:
figure()
I receive the error:
signal (11): Segmentation fault
unknown function (ip: 0x32736)
Segmentation fault (core dumped)
and Julia exits of course.
I don't know if this is relevant, but out of curioustiy I tried the following thing. After starting python in the command line, I do:
import matplotlib.pyplot
which gives me the following error message:
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 29, in <module>
import matplotlib.colorbar
File "/usr/lib/python2.7/dist-packages/matplotlib/colorbar.py", line 34, in <module>
import matplotlib.collections as collections
File "/usr/lib/python2.7/dist-packages/matplotlib/collections.py", line 27, in <module>
import matplotlib.backend_bases as backend_bases
File "/usr/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 62, in <module>
import matplotlib.textpath as textpath
File "/usr/lib/python2.7/dist-packages/matplotlib/textpath.py", line 15, in <module>
import matplotlib.font_manager as font_manager
File "/usr/lib/python2.7/dist-packages/matplotlib/font_manager.py", line 58, in <module>
from matplotlib import ft2font
ImportError: numpy.core.multiarray failed to import
All help appreciated.
EDIT:
I fixed the problem in python with the import statement by simply uninstalling and reinstalling matplotlib via pip. However, this changed nothing for Julia.
In the end I managed to solve the problem with the help of a colleague.
I first re-installed matplotlib via pip.
I had to point Julia to the system installed Python:
ENV["PYTHON"]="/usr/bin/python"
I then rebuilt PyCall and PyPlot:
Pkg.build("PyCall")
Pkg.build("PyPlot")
Restarted Julia and it worked!
I am trying to import pandas in an ipython (2.2.0, running python 3.3.5) notebook in my browser, which fails with
[...]
/usr/local/lib/python3.3/site-packages/numpy/add_newdocs.py in <module>()
11 from __future__ import division, absolute_import, print_function
12
---> 13 from numpy.lib import add_newdoc
14
15 ###############################################################################
/usr/local/lib/python3.3/site-packages/numpy/lib/__init__.py in <module>()
15 from .ufunclike import *
16
---> 17 from . import scimath as emath
18 from .polynomial import *
19 #import convertcode
ImportError: cannot import name scimath
However, in both pure python and non-notebook ipython, import pandas and the problematic line of from numpy.lib import add_newdoc run without a problem, and the file /usr/local/lib/python3.3/site/site-packages/numpy/lib/scimath.py exists and has the same permissions and creation date as the __init__.py in the same directory.
How do I debug this error? What does ipython notebook change about imports as compared to cli ipython?
See this previous question and answer - https://stackoverflow.com/a/15622021/1766755.
A key difference between the IPy notebook and CLI is the default behavior of the os.path var, as well as the notebook setting notebook_dir.
Obviously in the IPy notebook, pandas is not finding the scimath module. If you look closely at the traceback, you'll see the line
17 from . import scimath as math
This is a relative path import, the . signifying a request to import a module from the same directory. Depending on where the CLI is begun vs where you tell IPython to think it's running from, this could be the cause of numpy not finding scimath. I could be wrong, but it's happened to me before.