Coder Social home page Coder Social logo

Comments (3)

brycepg avatar brycepg commented on September 26, 2024

What's happening is that Python prefers to look for modules in relative paths before absolute paths. Since you can import noise from the repo directory, that means it's probably already in your python path(an absolute path).

Say this repository lives in foo/noise/ and now you are in foo/ if you go up a directory and try to run import noise. Python will see that the local directory noise/ as a module because it has an __init__.py file and try to import the directory instead of the module installed in your python path. Since this module requires the _noise and _simplex C extensions to be compiled, this wont work.

I'd recommend removing or renaming this repo directory from your project and use pip to install noise if you haven't already. (pip install noise)

If you really want to install from source and not install into your system, then, in the noise/ repository, run python setup.py build to build locally and grab dist/lib*/noise/ and put that directory into your project directory.

Alternatively use python setup.py install in the noise/ repository to install from source into your Python path.

from noise.

Shaderboy avatar Shaderboy commented on September 26, 2024

Hey thanks for the detailed response. I originally installed it using python setup.py install as you say. Moving it out of the working directory did in fact resolve the issue. Thanks! Quick follow up question though: I also have other modules like caffe, and protobuf in that directory. Why can I import those with no issue?

Edit: For some reason this seems to have broken caffe now... When running my original script (even without importing noise) it gives me this:

Traceback
(most recent call last):
File "live.py", line 13, in
import caffe
File "/home/chris/code/deepDream/caffe/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/home/chris/code/deepDream/caffe/python/caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: libcudart.so.7.5: cannot open shared object file: No such file or directory

Why would just moving the noise directory fuck with caffe?

Edit Edit: Ugh, nevermind. Several different, independent things are throwing the same error about missing .so files... It looks like this issue is distinct from anything happening with the noise lib.

from noise.

brycepg avatar brycepg commented on September 26, 2024

You're welcome.

__init__.py depends on _perlin and _simplex which are shared object files compiled from Python C extensions. If you did python setup.py build and then copied dist/lib*/*.so (assuming you're on linux) into the main noise repo directory, then what you are doing would work.

from noise.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.