Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized constant PyCall::LibPython::Helpers #145

Open
MuthukkaruppanSubramanian opened this issue Jun 19, 2021 · 7 comments
Open

uninitialized constant PyCall::LibPython::Helpers #145

MuthukkaruppanSubramanian opened this issue Jun 19, 2021 · 7 comments

Comments

@MuthukkaruppanSubramanian
Copy link

MuthukkaruppanSubramanian commented Jun 19, 2021

irb(main):001:0> require 'pycall/import'
=> true
irb(main):002:0> include PyCall::Import
=> Object
irb(main):003:0> pyimport :os
DEBUG(find_libpython) find_libpython("C:\\Users\\60026865.ICU_DOMAIN\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib")
DEBUG(find_libpython) investigate_python_config("C:\\Users\\60026865.ICU_DOMAIN\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib")
Traceback (most recent call last):
        8: from C:/Ruby25-x64/bin/irb.cmd:19:in `<main>'
        7: from (irb):3
        6: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/import.rb:18:in `pyimport'
        5: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall.rb:73:in `import_module'
        4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/init.rb:16:in `const_missing'
        3: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/init.rb:33:in `init'
        2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/libpython/finder.rb:42:in `find_libpython'
        1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/libpython/finder.rb:37:in `find_python_config'
PyCall::PythonNotFound (PyCall::PythonNotFound)
irb(main):004:0> pyimport :os
Traceback (most recent call last):
        4: from C:/Ruby25-x64/bin/irb.cmd:19:in `<main>'
        3: from (irb):4
        2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/import.rb:18:in `pyimport'
        1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall.rb:73:in `import_module'
NameError (uninitialized constant PyCall::LibPython::Helpers)

Environment Variables:

C:\WINDOWS\system32>echo %PYTHON%
C:\Users\60026865.ICU_DOMAIN\AppData\Local\Programs\Python\Python38-32\Lib

C:\WINDOWS\system32>echo %PYTHON_CONFIGURE_OPTS%
'--enable-shared'

Also added python location to environment variables.

@mrkn
Copy link
Owner

mrkn commented Jun 29, 2021

You need to specify the path of python executable in PYTHON environment variable.

@MuthukkaruppanSubramanian
Copy link
Author

MuthukkaruppanSubramanian commented Jul 12, 2021

Hi,

Thanks for response. I had added the following value to PYTHON env var.

"C:\Users\_user_name\AppData\Local\Programs\Python\Python38-32\pythonw.exe"

but still I could see issues as below

irb(main):002:0> require 'pycall/import'
=> true
irb(main):003:0> include PyCall::Import
=> Object
irb(main):004:0> pyimport :os
DEBUG(find_libpython) find_libpython("C:\\Users\\_user_name\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib")
DEBUG(find_libpython) investigate_python_config("C:\\Users\\_user_name\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib")
Traceback (most recent call last):
        8: from C:/Ruby25-x64/bin/irb.cmd:19:in `<main>'
        7: from (irb):4
        6: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/import.rb:18:in `pyimport'
        5: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall.rb:73:in `import_module'
        4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/init.rb:16:in `const_missing'
        3: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/init.rb:33:in `init'
        2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/libpython/finder.rb:42:in `find_libpython'
        1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/libpython/finder.rb:37:in `find_python_config'
PyCall::PythonNotFound (PyCall::PythonNotFound)
irb(main):005:0> pyimport :os
Traceback (most recent call last):
        4: from C:/Ruby25-x64/bin/irb.cmd:19:in `<main>'
        3: from (irb):5
        2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall/import.rb:18:in `pyimport'
        1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/pycall-1.4.0/lib/pycall.rb:73:in `import_module'
NameError (uninitialized constant PyCall::LibPython::Helpers)
irb(main):006:0>

Really appreciate your response. Thanks

@mrkn mrkn removed the feedback label Jul 13, 2021
@mrkn mrkn reopened this Jul 13, 2021
@Zaxser
Copy link

Zaxser commented Jul 28, 2021

I seem to be having the same problem after installing aeneas with their all-in-one package. I suspect, at least in my case, that I have the opposite problem, that I have too many versions of python installed and pycall is confused.

image

@Zaxser
Copy link

Zaxser commented Jul 29, 2021

Hm. Alright. Tried a few things, none of them worked. Dug around in pycall's code a bit. It looks like it's asking for ENV["PYTHON"] but not finding it. Actually, I had no idea that this is variable was here.

Anyway, after I added a PYTHON path to the variable list (make sure it's not SYSTEM variables, at the bottom of the environmental variable screen, but the ENVIRONMENTAL variables at the top), my scripts that used Pycall started working again. Thank you.

@Zaxser
Copy link

Zaxser commented Jul 29, 2021

Hmm. It seems to work with one python module (genanki) and not another (aeneas), I'm getting another const missing error, The solution is probably to add more variables.

        5: from aeneas-timings.rb:3:in `<main>'
        4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/pycall-1.4.1/lib/pycall.rb:74:in `import_module'
        3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/pycall-1.4.1/lib/pycall/init.rb:16:in `const_missing'
        2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/pycall-1.4.1/lib/pycall/init.rb:33:in `init'
        1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/pycall-1.4.1/lib/pycall/libpython/finder.rb:42:in `find_libpython'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/pycall-1.4.1/lib/pycall/libpython/finder.rb:37:in `find_python_config': PyCall::PythonNotFound (PyCall::PythonNotFound)

@Zaxser
Copy link

Zaxser commented Jul 29, 2021

Oh god. It's looking for a variable called PYTHONHOME in my environmental variables. It's not there, and then... it looks like it's deciding to use_conda, except I don't have anaconda. Hmm.

In my head:

"He swallowed the Anaconda to shave the Yak; He swallowed the Yak to catch the Python; To run on Ruby; To catch the fly; I don't know why he swallowed the fly..."

@Zaxser
Copy link

Zaxser commented Jul 30, 2021

Eventually, I just gave up and set up an environment on WSL, like I probably should have done in the first place.

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

No branches or pull requests

3 participants