sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.48k stars 488 forks source link

QEPCAD not working in python package of SageMath #38779

Open anirjoshi opened 1 month ago

anirjoshi commented 1 month ago

Steps To Reproduce

  1. My machine is Mac M2 with the OS Ventura 13.4
  2. I already have anaconda installed: conda --version prints conda 23.10.0
  3. I used the command conda create -n sage sage python=3.9 to install sage in python as explained in installation guide
  4. Then setting the environment using conda activate sage sets the appropriate environment.
  5. The following program returns an error:
    from sage.all import *
    var('a,b,c,d,x,y,z')
    qf = qepcad_formula
    ellipse = Integer(3)*x**Integer(2) + Integer(2)*x*y + y**Integer(2) - x + y - Integer(7)
    F = qf.exists(y, ellipse == Integer(0)); F
    qepcad(F)    

Expected Behavior

There should be no error and a formula should be returned.

Actual Behavior

The error reported is

Traceback (most recent call last):
  File "/path/anaconda3/envs/sage/lib/python3.9/site-packages/sage/interfaces/expect.py", line 521, in _start
    self._expect.expect(self._prompt)
  File "/path/anaconda3/envs/sage/lib/python3.9/site-packages/pexpect/spawnbase.py", line 354, in expect
    return self.expect_list(compiled_pattern_list,
  File "/path/anaconda3/envs/sage/lib/python3.9/site-packages/pexpect/spawnbase.py", line 383, in expect_list
    return exp.expect_loop(timeout)
  File "/path/anaconda3/envs/sage/lib/python3.9/site-packages/pexpect/expect.py", line 179, in expect_loop
    return self.eof(e)
  File "/path/anaconda3/envs/sage/lib/python3.9/site-packages/pexpect/expect.py", line 122, in eof
    raise exc
pexpect.exceptions.EOF: End Of File (EOF). Empty string style platform.
Qepcad with PID 92720 running /path/bin/env qe=/path/anaconda3/envs/sage qepcad
command: /path/bin/env
args: ['/path/bin/env', 'qe=/path/anaconda3/envs/sage', 'qepcad']
buffer (last 100 chars): b''
before (last 100 chars): b'env: qepcad: No such file or directory\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 92720
child_fd: 6
closed: False
timeout: None
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 4194304
ignorecase: False
searchwindowsize: None
delaybeforesend: None
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile(b'\nEnter an .*:\r')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sage/misc/lazy_import.pyx", line 404, in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:4514)
  File "/path/anaconda3/envs/sage/lib/python3.9/site-packages/sage/interfaces/qepcad.py", line 1631, in qepcad
    qe = Qepcad(formula, vars=vars, **kwargs)
  File "/path/anaconda3/envs/sage/lib/python3.9/site-packages/sage/interfaces/qepcad.py", line 876, in __init__
    qex._send('[ input from Sage ]')
  File "/path/anaconda3/envs/sage/lib/python3.9/site-packages/sage/interfaces/expect.py", line 267, in _send
    self._start()
  File "/path/anaconda3/envs/sage/lib/python3.9/site-packages/sage/interfaces/expect.py", line 525, in _start
    raise RuntimeError("unable to start %s: %s" % (self.name(), msg))
RuntimeError: unable to start QEPCAD: End Of File (EOF). Empty string style platform.
Qepcad with PID 92720 running /usr/bin/env qe=/Users/ani/anaconda3/envs/sage qepcad
command: /path/bin/env
args: ['/path/bin/env', 'qe=/path/anaconda3/envs/sage', 'qepcad']
buffer (last 100 chars): b''
before (last 100 chars): b'env: qepcad: No such file or directory\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 92720
child_fd: 6
closed: False
timeout: None
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 4194304
ignorecase: False
searchwindowsize: None
delaybeforesend: None
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile(b'\nEnter an .*:\r')

Additional Information

No response

Environment

Checklist

culler commented 1 month ago

FWIW, this does not produce any error with the macOS binary package Sagemath-10-4.app. That app uses Python 3.12.