Ask Your Question

louisng114's profile - activity

2019-10-20 23:03:14 +0200 received badge  Popular Question (source)
2018-01-02 04:24:07 +0200 received badge  Scholar (source)
2018-01-02 04:08:54 +0200 commented answer PackageNotFoundError and SyntaxError

It works in VM, but not Windows.

2018-01-02 04:08:20 +0200 received badge  Supporter (source)
2018-01-01 22:37:05 +0200 commented answer PackageNotFoundError and SyntaxError

It still doesn't work. I updated the question to show the new errors I am getting.

2018-01-01 18:51:54 +0200 commented answer PackageNotFoundError and SyntaxError

How do I do that?

2017-12-31 17:47:12 +0200 received badge  Editor (source)
2017-12-31 17:03:43 +0200 received badge  Student (source)
2017-12-31 12:46:45 +0200 asked a question PackageNotFoundError and SyntaxError

In a notebook, when I entered

p = Polyhedron(ieqs=[(0,1,0,0,0,0,0,0,0),(0,0,0,0,0,1,0,0,0),(0,-1,1,0,0,0,0,0,0),(0,0,-1,1,0,0,0,0,0),(0,0,0,-1,1,0,0,0,0),(0,0,0,0,-1,0,0,0,1),(0,0,0,0,0,-1,1,0,0),(0,0,0,0,0,0,-1,1,0),(0,0,0,0,0,0,0,-1,1),(1,-1,-1,-1,-1,-1,-1,-1,-1)])

and

H1 = Polyhedron(eqns=[(0,-1,0,0,0,1,0,0,0)])
q1 = p.intersection(H1)
q1.vertices()

everything was fine, but when I typed in

(1000*q1).integral_points_count()

I got the following message:

 --------------------------------------------------------------------------- PackageNotFoundError                  
 Traceback (most recent call last)
 <ipython-input-75-395b663ed32e> in
 <module>()
 ----> 1 (Integer(1000)*q1).integral_points_count()

 /opt/sagemath-8.1/local/lib/python2.7/site-packages/sage/geometry/polyhedron/base_QQ.py
 in integral_points_count(self,
 verbose, use_Hrepresentation,
 explicit_enumeration_threshold,
 preprocess, **kwds)
     216                 cdd=True,
     217                 verbose=verbose,
 --> 218                 **kwds)

 /opt/sagemath-8.1/local/lib/python2.7/site-packages/sage/interfaces/latte.py
 in count(arg, ehrhart_polynomial,
 multivariate_generating_function,
 raw_output, verbose, **kwds)
     148     except OSError:
     149         from sage.misc.package import PackageNotFoundError
 --> 150         raise PackageNotFoundError('latte_int')
     151 
     152     ans, err = latte_proc.communicate(arg)

 PackageNotFoundError: the package
 'latte_int' was not found. You can
 install it by running 'sage -i
 latte_int' in a shell

However, when I used sage -i latte_int, I got the error message

  File "<ipython-input-76-d56a71c64d98>", line 1
    sage -i latte_int
                    ^
SyntaxError: invalid syntax

Does anyone know why am I getting these conflicting messages? I tried it both on a VirtualBox and Windows, but they both give the same messages.

EDIT2: sage -i latte_int works in VirtualBox when typed in a terminal.

EDIT: When I open a shell, there is a message on top saying

Starting subshell with Sage environment variable set. Don't forget to exit when you are done. Beware: * Do not do anything with other copies of Sage on your system. * Do not use this for installing Sage packages using "sage -i" or for running "make" at Sage's root directory. These should be done outside the Sage shell.

When I enter sage -i latte_int in anyway, I get

make: *** No rule to make target 'all-toolchain'.  Stop.

Typing sage -i latte_int in a terminal or console gives the same result.

Entering !sage -i latte_int in a Notebook, I get an OSError

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-1-f5647ef902a7> in <module>()
----> 1 get_ipython().system(u'sage -i latte_int')

/opt/sagemath-8.1/local/lib/python2.7/site-packages/IPython/core/interactiveshell.py in system_piped(self, cmd)
   2207         # a non-None value would trigger :func:`sys.displayhook` calls.
   2208         # Instead, we store the exit_code in user_ns.
-> 2209         self.user_ns['_exit_code'] = system(self.var_expand(cmd, depth=1))
   2210 
   2211     def system_raw(self, cmd):

/opt/sagemath-8.1/local/lib/python2.7/site-packages/IPython/utils/_process_posix.py in system(self, cmd)
    155                 child = pexpect.spawnb(self.sh, args=['-c', cmd]) # Pexpect-U
    156             else:
--> 157                 child = pexpect.spawn(self.sh, args=['-c', cmd])  # Vanilla Pexpect
    158             flush = sys.stdout.flush
    159             while True:

/opt/sagemath-8.1/local/lib/python2.7/site-packages/pexpect/pty_spawn.py in __init__(self, command, args, timeout, maxread, searchwindowsize, logfile, cwd, env, ignore_sighup, echo, preexec_fn, encoding, codec_errors, dimensions)
    196             self.name = '<pexpect factory incomplete>'
    197         else:
--> 198             self._spawn(command, args, preexec_fn, dimensions)
    199 
    200     def __str__(self):

/opt/sagemath-8.1/local/lib/python2.7/site-packages/pexpect/pty_spawn.py in _spawn(self, command, args, preexec_fn, dimensions)
    296 
    297         self.ptyproc = self._spawnpty(self.args, env=self.env,
--> 298                                      cwd=self.cwd, **kwargs)
    299 
    300         self.pid = self.ptyproc.pid

/opt/sagemath-8.1/local/lib/python2.7/site-packages/pexpect/pty_spawn.py in _spawnpty(self, args, **kwargs)
    307     def _spawnpty(self, args, **kwargs):
    308         '''Spawn a pty and return an instance of PtyProcess.'''
--> 309         return ptyprocess.PtyProcess.spawn(args, **kwargs)
    310 
    311     def close(self, force=True):

/opt/sagemath-8.1/local/lib/python2.7/site-packages/ptyprocess/ptyprocess.py in spawn(cls, argv, cwd, env, echo, preexec_fn, dimensions)
    218 
    219         if use_native_pty_fork:
--> 220             pid, fd = pty.fork()
    221         else:
    222             # Use internal fork_pty, for Solaris

/opt/sagemath-8.1/local/lib/python2.7/pty.py in fork()
    106 
    107     master_fd, slave_fd = openpty()
--> 108     pid = os.fork()
    109     if pid == CHILD:
    110         # Establish a new session.

OSError: [Errno 11] Resource temporarily unavailable