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!
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 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
I am trying to use Scrapy with Anaconda/Miniconda on Windows 10. Installation goes fine, but trying to actually run Scrapy gives the following error:
Traceback (most recent call last):
File "C:\ProgramData\Miniconda3\Scripts\scrapy-script.py", line 6, in <module>
from scrapy.cmdline import execute
File "C:\ProgramData\Miniconda3\lib\site-packages\scrapy\__init__.py", line 34, in <module>
from scrapy.spiders import Spider
File "C:\ProgramData\Miniconda3\lib\site-packages\scrapy\spiders\__init__.py", line 10, in <module>
from scrapy.http import Request
File "C:\ProgramData\Miniconda3\lib\site-packages\scrapy\http\__init__.py", line 11, in <module>
from scrapy.http.request.form import FormRequest
File "C:\ProgramData\Miniconda3\lib\site-packages\scrapy\http\request\form.py", line 11, in <module>
import lxml.html
File "C:\ProgramData\Miniconda3\lib\site-packages\lxml\html\__init__.py", line 53, in <module>
from .. import etree
ImportError: DLL load failed: The specified module could not be found.
I have tried reinstalling Scrapy, lxml, and Anaconda itself (this time, I'm using a clean install of Miniconda), as well as downloading unofficial lxml build from https://www.lfd.uci.edu/~gohlke/pythonlibs/, as suggested in one of the answers on Stack Overflow, but the problem persists. I have also done this on an Amazon AWS EC2 instance started from scratch, but I'm getting the same issue.
It seems to be something relatively common, but I couldn't find an answer that would work for me. What's an appropriate way to address this? Is it just about lxml, or is there something else causing this problem?
I have pymc installed, and I am now trying to import it in my code. However,
First when I do import pymc, I got the error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/__init__.py", line 30, in <module>
from .CommonDeterministics import *
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/CommonDeterministics.py", line 21, in <module>
from .utils import safe_len, stukel_logit, stukel_invlogit, logit, invlogit, value, find_element
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/utils.py", line 14, in <module>
from . import flib
ImportError: numpy.core.multiarray failed to import
which can be fixed by manually import numpy.core.multiarray, but then, when I try again to import pymc, I got another error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/__init__.py", line 30, in <module>
from .CommonDeterministics import *
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/CommonDeterministics.py", line 13, in <module>
from . import PyMCObjects as pm
ImportError: cannot import name PyMCObjects
I googled around, and the solutions to similar problems are either:
In case that's related to the installation of pymc, force using the 32-bit instead of 64. However, this answer is for Windows users, and I have OS X 10.9 (Mavericks).
In other cases, it's usually due to a circular dependency (for example, here), which I don't think is the case here.
My guess is that something is wrong with the package flib, but I couldn't figure out what. I would appreciate any answer/hint on this problem. Thanks in advance!
Update (July-4-2014)
Thanks, Chris! I rebuilt my pymc using the conda build by doing conda install -c https://conda.binstar.org/tobeplugged pymc, and now when I do import pymc, a different error message appears:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python2.7/site-packages/pymc-2.3.3-py2.7-macosx-10.9-x86_64.egg/pymc/__init__.py", line 44, in <module>
from . import CommonDeterministics
ImportError: cannot import name CommonDeterministics
As Chris pointed out (see comments below), the problem(s) is being looked at here. The problem seems to have to do with the version of gcc (version 4.9). I will try to rebuild my gcc with the older version (4.8.2) later today to see if that will solve the problem for OS X 10.9 (Mavericks). Otherwise, I believe people can wait a little bit for the pymc team to solve this problem, too.