Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

"Segmentation fault: 11" while importing ModelFactory #3851

Open
nbro opened this issue Aug 29, 2018 · 6 comments
Open

"Segmentation fault: 11" while importing ModelFactory #3851

nbro opened this issue Aug 29, 2018 · 6 comments

Comments

@nbro
Copy link
Member

nbro commented Aug 29, 2018

System Information

OS: Mac OS X, version 10.13.6 (High Sierra)
Python: 2.7.10 (System's one, under /usr/bin) and 2.7.15 (Homebrew-installed one, under /usr/local/bin)
GCC: g++ (GCC) 6.3.1 20170510 (for GNAT GPL 2017 20170515)
Apple LLVM version 9.1.0 (clang-902.0.39.2), Target: x86_64-apple-darwin17.7.0, Thread model: posix

Problem Description

I installed NuPIC in a virtual environment by issuing the command pip install nupic. This also installed all NuPIC's dependencies, including nupic.bindings. I can import nupic normally without getting errors, but if I try to import ModelFactory from nupic.frameworks.opf.model_factory I get a "Segmentation fault: 11".

Python 2.7.10 (default, Oct  6 2017, 22:29:07) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nupic
>>> from nupic.frameworks.opf.model_factory import ModelFactory
Segmentation fault: 11

or, using Homebrew installed one,

Python 2.7.15 (default, Jun 17 2018, 12:46:58) 
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nupic
>>> from nupic.frameworks.opf.model_factory import ModelFactory
Segmentation fault: 11

Even if I install NuPIC from the local source code, using pip install . I get a "segmentation fault 11".

I have looked for similar issues. It's not the first time that people, in the NuPIC community, report a "segmentation fault" error.

Comments

In the README file, you state that NuPIC binaries are only available for OSX 10.9 and 10.10, so I suppose that no one has tried to port NuPIC to (or test on) OS X 10.13. Anyway, NuPIC (not nupic.core) is a Python package, so I don't really get what you mean by "binary" here, in this context.

If this is an issue that all Mac OS X 10.13 users have, then this is a big limitation, I think, and the issue should be solved.

I am a bit puzzled that I can import nupic, but not that particular class. nupic.frameworks.opf.model_factory probably contains the execution of code which causes this segmentation fault.

Question

Can some Mac OS X user reproduce this error?

@nbro
Copy link
Member Author

nbro commented Aug 30, 2018

I've just noticed that I'm getting this "segmentation fault 11" in several other cases (e.g. when simply importing from nupic.encoders.scalar import *), but I've still not understood what's causing it. The strangest thing is that, when I try to do from nupic.encoders.scalar import *, the "segmentation fault 11" seems to be caused by the import statement from nupic.encoders.base import Encoder, EncoderResult, but I can directly import both Encoder and EncoderResult (using from nupic.encoders.base import Encoder, EncoderResult), without any errors.

@nbro
Copy link
Member Author

nbro commented Aug 30, 2018

I installed NuPIC, on an Ubuntu 16.04 virtual machine, using Python 2.7.12. So far, I have not run into this issue. Later, I will try to install it on the Python versions 2.7.10 and 2.7.15. This will be my workaround until I (or someone else) solve this "segmentation fault 11" problem.

@rhyolight
Copy link
Member

I think you'll have to compile locally on 10.13.6. We don't continue to support the latest OS builds.

@rhyolight
Copy link
Member

rhyolight commented Sep 5, 2018

I was just talking to @lscheinkman and he is running the same OS as you @nbro. He thinks this has something to do with your virtualenv python environment. The Seg11 does not tell us much. Brew is not going to work either.

I suggest you try to get virtualenv setup as bare as possible, make sure there is no numpy there before you install nupic. In the past, this problem has been a symptom of some numpy dependency mismatch.

If nothing else works, try outside of virtualenv. At least that will tell us that it is a problem with the python environment.

@nbro
Copy link
Member Author

nbro commented Sep 5, 2018

I installed NuPIC on an empty virtual environment (apart from the default Python packages that are added automatically to the environment when you create it, i.e. pip, setuptools and wheel).

I will try to install it outside of the virtual environment, but I don't think this is the problem (I think I already tried it).

@rhyolight
Copy link
Member

There is something off in your python environment. Sometimes bad things in your global python env can leak into virtualenv. That has happened to me before.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants