3

I have some code that solves an LP using the PuLP module, and it worked when using a 64-bit windows machine. Now I am trying to run the same code on a Raspberry Pi 4 using Raspbian. Creating the objective function and the constraints works fine, but when I try to solve the LP, I get the following error:

status = solver.actualSolve(self, **kwargs)
AttributeError: 'NoneType' object has no attribute 'actualSolve'

First I read that I should try running pulp.pulpTestAll(), but I only get the following error:

import pulp
pulp.pulpTestAll()
Traceback (most recent call last):
  File "<pyshell>", line 1, in <module>
AttributeError: module 'pulp' has no attribute 'pulpTestAll'

tried specifying the solver and the path in the line that executes solve():

prob.solve(PULP_CBC_CMD(path='/usr/local/lib/python3.7/dist-packages/pulp/solverdir/cbc/linux/32/cbc'))

Which resulted in the following error:

pulp.solvers.PulpSolverError: PULP_CBC_CMD: Not Available (check permissions on /usr/local/lib/python3.7/dist-packages/pulp/solverdir/cbc/linux/32/cbc)

But the cbc file's Execute permission is set to "Nobody", and I am unable to change it.

I'm not sure how to work around this. Any suggestions?

Ken Bassett
  • 58
  • 1
  • 7
  • How did you install pulp on the Raspberry Pi? Did you do `pip install pulp` or `sudo pip install pulp`? – kabdulla Dec 27 '19 at 18:46
  • @kabdulla I typed sudo pip3 install pulp – Ken Bassett Dec 28 '19 at 20:21
  • Ok. I think you should be able to change the permissions for the offending file(s) but you'll likely need to `sudo` it. https://www.computerhope.com/unix/uchmod.htm ... also I've been recommended to do (for example) `sudo -H pip2 install pulp`. This sets the home directory to your user directory rather than root. https://www.computerhope.com/unix/sudo.htm – kabdulla Dec 29 '19 at 13:32
  • Can you execute the cbc solver bvia the command line? i.e., running `/usr/local/lib/python3.7/dist-packages/pulp/solverdir/cbc/linux/32/cbc` via the command line works? Also, try to install pulp without sudo in your user directory with `pip install pulp --user` – pchtsp May 27 '20 at 21:25
  • try reinstall snakemake. I guess you only updated snakemake but not the pulp package. Now pulp is not compatible to the latest version of snakemake. – zhanxw Sep 25 '20 at 20:46

1 Answers1

0

Try:

conda install -c conda-forge pulp

(Default: PuLP v 1.6.8)

Instead of:

pip install pulp

(Default: PuLP v 2.1)