Giter Club home page Giter Club logo

Comments (11)

lmcinnes avatar lmcinnes commented on April 28, 2024 1

Wow, good catch! Thanks for the reference -- it saved me an evening of (probably very frustrating) googling. I think I have it fixed, but I would greatly appreciate it if you can test on your system (if you have time) to ensure that it does indeed resolve the issue for you. Thanks!

from umap.

MSiam avatar MSiam commented on April 28, 2024

I am encountering the same exact error even after your change.

from umap.

lmcinnes avatar lmcinnes commented on April 28, 2024

If that's the case then I must admit I am really not sure what the correct fix is -- this involves numba internals which I am not familiar with. I'll have to try and ask numba developers what the right solution to this is, which unfortunately may take a while. As an interim solution you can check out the code and simply remove or comment out code blocks

if verbose:
    print(...)

Ultimately I would prefer a more complete solution though, as the progress logging is really quite useful.

from umap.

sauln avatar sauln commented on April 28, 2024

This is strange. I could try changing the prints to the logging module, but it looks like the problem comes during a string conversion, not the print function.

Does this happen always with python 2.7? Is there a formula for recreating the issue so I can play around with it?

from umap.

MSiam avatar MSiam commented on April 28, 2024

I am using python2.7 yes. I just ran the examples/digits/digits.py code nothing from my side and it gave this error:

raise NotImplementedError("cannot convert native %s to Python object" % (typ,))
LoweringError: cannot convert native const('\tnn descent iteration ') to Python object
File "build/bdist.linux-x86_64/egg/umap/umap_.py", line 455
[1] During: lowering "print($515.5)" at build/bdist.linux-x86_64/egg/umap/umap_.py (455)

Failed at nopython (nopython mode backend)
cannot convert native const('\tnn descent iteration ') to Python object
File "build/bdist.linux-x86_64/egg/umap/umap_.py", line 455
[1] During: lowering "print($515.5)" at build/bdist.linux-x86_64/egg/umap/umap_.py (455)

Thanks removing the if verbose, made it work.

from umap.

lmcinnes avatar lmcinnes commented on April 28, 2024

I suspect the logging module will not play nicely with numba; perhaps this is a python2/python3 compatability issue related to the print function? @sauln if you have some time to look into this I would greatly appreciate it as I don't have a lot of time for the next week or so.

from umap.

sauln avatar sauln commented on April 28, 2024

I think it's some combination of print statements and string operations in python 2.

Multiple print arguments like

print("hello", "world")

cause the error and I haven't figured out any other way to format strings in numba.

This issue talks briefly about numba+print, but it was closed without explicit resolution.

I haven't found any way around this problem. There might be something in the numba documentation, but nothing has come up from google searches. I'll try to dig a bit more into this tomorrow.

from umap.

lmcinnes avatar lmcinnes commented on April 28, 2024

Thanks Nathaniel, at least we know what the likely issue is. One possibility is to use cffi and get the printf function from C to do the formatted printing, but that adds an extra dependency on cffi. Another option would be to explicitly write a very constrained function to do the limited format of printing we need and call that instead. I would welcome other ideas as neither of those seem optimal.

from umap.

sauln avatar sauln commented on April 28, 2024

It might be hacky, but it should be possible to require cffi only for python2.7. That would force maintenance of two different logging systems though. As a first step, it's probably easiest to disable all logging on 2.7.

What do you think about having different behavior for 2.7 and 3? It's not ideal, but at least that way, 3+ could have complete and pretty logging.

from umap.

lmcinnes avatar lmcinnes commented on April 28, 2024

from umap.

sauln avatar sauln commented on April 28, 2024

I’ll look into it tonight.

from umap.

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.