Pulp library run error
Hello,
I have been successfully running a python program in the Jupyter environment.
I am now trying to run it with the Carnets app on IOS.
I have successfully installed the Pulp solver library ("requirement satisfied"), however I am still getting runtime errors.
Would appreciate any guidance how to solve?
Error output below.
thanks, Tony.
PulpSolverError Traceback (most recent call last) Cell In [3], line 234 232 squad = True 233 blended = False --> 234 selected_players = get_optimised_squad (players_df, criteria, squad, blended, fixed_players_df) 235 output_squad(selected_players, criteria, squad, blended) 237 criteria = 'form'
Cell In [3], line 167, in get_optimised_squad(players_df, criteria, squad, blended, fixed_players_df) 163 prob += lpSum([player_vars[i] for i in player if teamid[int(i)] == club]) <= 3 # 3 Club Limit 166 # solve --> 167 status = prob.solve() 170 # print ('total points of players = ',(value(prob.objective))) 171 172 # print () 173 # print () 174 # print ('problem status :', status, ' (', LpStatus[prob.status],')') 176 lookup_player = []
File /var/mobile/Containers/Data/Application/C361BC6E-4CAB-4957-97D4-D611E4AEEF77/Library/lib/python3.11/site-packages/pulp/pulp.py:1913, in LpProblem.solve(self, solver, **kwargs) 1911 # time it 1912 self.startClock() -> 1913 status = solver.actualSolve(self, **kwargs) 1914 self.stopClock() 1915 self.restoreObjective(wasNone, dummyVar)
File /var/mobile/Containers/Data/Application/C361BC6E-4CAB-4957-97D4-D611E4AEEF77/Library/lib/python3.11/site-packages/pulp/apis/coin_api.py:137, in COIN_CMD.actualSolve(self, lp, **kwargs) 135 def actualSolve(self, lp, **kwargs): 136 """Solve a well formulated lp problem""" --> 137 return self.solve_CBC(lp, **kwargs)
File /var/mobile/Containers/Data/Application/C361BC6E-4CAB-4957-97D4-D611E4AEEF77/Library/lib/python3.11/site-packages/pulp/apis/coin_api.py:206, in COIN_CMD.solve_CBC(self, lp, use_mps) 204 if pipe: 205 pipe.close() --> 206 raise PulpSolverError( 207 "Pulp: Error while trying to execute, use msg=True for more details" 208 + self.path 209 ) 210 if pipe: 211 pipe.close()
PulpSolverError: Pulp: Error while trying to execute, use msg=True for more details/var/mobile/Containers/Data/Application/C361BC6E-4CAB-4957-97D4-D611E4AEEF77/Library/lib/python3.11/site-packages/pulp/solverdir/cbc/osx/64/cbc
pulp relies on a binary executable (cbc) to do its work. It is installed by default on Carnets-with-Scipy, so I think the short answer is: "You need to switch to Carnets-with-Scipy" (both apps share the same iCloud folder, so you can move your work from one to the other).
The long answer is: the pip install process has probably confused your iPad (with an Arm64 processor, running a system named Darwin) with an M1 Mac (which also runs a system named Darwin, on an Arm64 processor... I understand the confusion). So it installed binaries and libraries for M1 Macs... which won't work on iOS because there is a protection against running executables downloaded from the internet.
Thank you very much holzschu for the suggestion. I will try this.
Yes! Works first time with Carnets-with-Scipy. Thank you so much.
I'm very confused with Apple's directory structures and access, but I can get the program in a carnets-with... folder and it works!
Great program.
Thank you.
I'm happy that the problem is solved.
Yes, the directory access permissions is one of the most complicated things in iOS.
- by default, each app can only access its own files (the ones inside itself, and the ones inside its iCloud folder).
- if you open a file from an app (say, using the file browser in Carnets), then you grant the app permission to access that file.
- but you did not grant permission to access the directory around it, which is an issue if you have data files or want to write files.
- hence the "unlock folder" button on the top right corner.
Carnets and Carnets-with-Scipy being siblings, they share the same iCloud folder, so they can both read and write all files to that folder.
Thank you for the additional iOS explanation. Very helpful.