DimaKudosh / pydfs-lineup-optimizer

Daily Fantasy Sports lineup optimzer for all popular daily fantasy sports sites
MIT License
423 stars 157 forks source link

Help Cant even get it started #237

Open cheez4 opened 3 years ago

cheez4 commented 3 years ago

I'm kind of new to this any help would be greatly appreciated.

When I run this from pydfs_lineup_optimizer import Site, Sport, get_optimizer

optimizer = get_optimizer(Site.DRAFTKINGS,Sport.BASKETBALL) optimizer.load_players_from_csv("DKSal.csv") lineup_generator = optimizer.optimize(10) for lineup in lineup_generator: print(lineup) optimizer.print_statistic()

It get the following

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pulp/pulp.py:1199: UserWarning: Spaces are not permitted in the name. Converted to '' warnings.warn("Spaces are not permitted in the name. Converted to ''")

OSError Traceback (most recent call last)

in 5 optimizer.load_players_from_csv("DKSal.csv") 6 lineup_generator = optimizer.optimize(10) ----> 7 for lineup in lineup_generator: 8 print(lineup) 9 optimizer.print_statistic() /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pydfs_lineup_optimizer/lineup_optimizer.py in optimize(self, n, max_exposure, randomness, with_injured, exposure_strategy) 382 constraint.apply_for_iteration(solver, previous_lineup) 383 try: --> 384 solved_variables = solver.solve() 385 lineup_players = [] 386 variables_names = [] /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pydfs_lineup_optimizer/solvers/pulp_solver.py in solve(self) 44 45 def solve(self): ---> 46 self.prob.solve(self.LP_SOLVER) 47 if self.prob.status == LpStatusOptimal: 48 result = [] /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pulp/pulp.py in solve(self, solver, **kwargs) 1735 #time it 1736 self.solutionTime = -clock() -> 1737 status = solver.actualSolve(self, **kwargs) 1738 self.solutionTime += clock() 1739 self.restoreObjective(wasNone, dummyVar) /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pulp/apis/coin_api.py in actualSolve(self, lp, **kwargs) 99 def actualSolve(self, lp, **kwargs): 100 """Solve a well formulated lp problem""" --> 101 return self.solve_CBC(lp, **kwargs) 102 103 def available(self): /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pulp/apis/coin_api.py in solve_CBC(self, lp, use_mps) 150 args.append(self.path) 151 args.extend(cmds[1:].split()) --> 152 cbc = subprocess.Popen(args, stdout = pipe, stderr = pipe, stdin=devnull) 153 if cbc.wait() != 0: 154 raise PulpSolverError("Pulp: Error while trying to execute, use msg=True for more details" + \ /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text) 854 encoding=encoding, errors=errors) 855 --> 856 self._execute_child(args, executable, preexec_fn, close_fds, 857 pass_fds, cwd, env, 858 startupinfo, creationflags, shell, /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session) 1726 if errno_num != 0: 1727 err_msg = os.strerror(errno_num) -> 1728 raise child_exception_type(errno_num, err_msg, err_filename) 1729 raise child_exception_type(err_msg) 1730 OSError: [Errno 8] Exec format error: '/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pulp/apis/../solverdir/cbc/linux/64/cbc'
Denwen12 commented 3 years ago

try downgrading pulp to 2.2 i think

On Sun, Jan 24, 2021, 10:54 PM cheez4 notifications@github.com wrote:

I'm kind of new to this any help would be greatly appreciated.

When I run this from pydfs_lineup_optimizer import Site, Sport, get_optimizer

optimizer = get_optimizer(Site.DRAFTKINGS,Sport.BASKETBALL) optimizer.load_players_from_csv("DKSal.csv") lineup_generator = optimizer.optimize(10) for lineup in lineup_generator: print(lineup) optimizer.print_statistic()

It get the following /data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pulp/pulp.py:1199: UserWarning: Spaces are not permitted in the name. Converted to ' ' warnings.warn("Spaces are not permitted in the name. Converted to ''")

OSError Traceback (most recent call last) in 5 optimizer.load_players_from_csv("DKSal.csv") 6 lineup_generator = optimizer.optimize(10) ----> 7 for lineup in lineup_generator: 8 print(lineup) 9 optimizer.print_statistic()

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pydfs_lineup_optimizer/lineup_optimizer.py in optimize(self, n, max_exposure, randomness, with_injured, exposure_strategy) 382 constraint.apply_for_iteration(solver, previous_lineup) 383 try: --> 384 solved_variables = solver.solve() 385 lineup_players = [] 386 variables_names = []

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pydfs_lineup_optimizer/solvers/pulp_solver.py in solve(self) 44 45 def solve(self): ---> 46 self.prob.solve(self.LP_SOLVER) 47 if self.prob.status == LpStatusOptimal: 48 result = []

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pulp/pulp.py in solve(self, solver, kwargs) 1735 #time it 1736 self.solutionTime = -clock() -> 1737 status = solver.actualSolve(self, kwargs) 1738 self.solutionTime += clock() 1739 self.restoreObjective(wasNone, dummyVar)

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pulp/apis/coin_api.py in actualSolve(self, lp, kwargs) 99 def actualSolve(self, lp, kwargs): 100 """Solve a well formulated lp problem""" --> 101 return self.solve_CBC(lp, **kwargs) 102 103 def available(self):

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pulp/apis/coin_api.py in solve_CBC(self, lp, use_mps) 150 args.append(self.path) 151 args.extend(cmds[1:].split()) --> 152 cbc = subprocess.Popen(args, stdout = pipe, stderr = pipe, stdin=devnull) 153 if cbc.wait() != 0: 154 raise PulpSolverError("Pulp: Error while trying to execute, use msg=True for more details" + \

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/subprocess.py in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text) 854 encoding=encoding, errors=errors) 855 --> 856 self._execute_child(args, executable, preexec_fn, close_fds, 857 pass_fds, cwd, env, 858 startupinfo, creationflags, shell,

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session) 1726 if errno_num != 0: 1727 err_msg = os.strerror(errno_num) -> 1728 raise child_exception_type(errno_num, err_msg, err_filename) 1729 raise child_exception_type(err_msg) 1730

OSError: [Errno 8] Exec format error: '/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/pulp/apis/../solverdir/cbc/linux/64/cbc'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/237, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7XNRJE5DXENQ3L5QJDS3TTPXANCNFSM4WRDT3EA .

cheez4 commented 3 years ago

Try that .. read through all the close issues

Denwen12 commented 3 years ago

can i see your whole script

On Sun, Jan 24, 2021, 11:26 PM cheez4 notifications@github.com wrote:

Try that .. read through all the close issues

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/237#issuecomment-766531107, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7VTUCDGPTW57DCM3FLS3TXHVANCNFSM4WRDT3EA .

Denwen12 commented 3 years ago

regular python will not work on android because of permissions so you might have to use QPython

On Sun, Jan 24, 2021, 11:27 PM joseph offen joffen12@gmail.com wrote:

can i see your whole script

On Sun, Jan 24, 2021, 11:26 PM cheez4 notifications@github.com wrote:

Try that .. read through all the close issues

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/237#issuecomment-766531107, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7VTUCDGPTW57DCM3FLS3TXHVANCNFSM4WRDT3EA .

cheez4 commented 3 years ago

Interesting thanks will try that

cheez4 commented 3 years ago

Now I'm here

/data/user/0/org.qpython.qpy3/files/bin/qpython3-android5.sh /storage/emulated/0/qpython/projects3/Dk/.last_tmp.py && exit jects3/Dk/.lasttmp.py && exit < /data/user/0/org.qpython.qpy3/files/lib/python3.6/site-packages/pulp/pulp.py:1199: UserWarning: Spaces are not permitted in the name. Converted to '' warnings.warn("Spaces are not permitted in the name. Converted to '_'") Traceback (most recent call last): File "/storage/emulated/0/qpython/projects3/Dk/.last_tmp.py", line 4, in for lineup in optimizer.optimize(10): File "/data/user/0/org.qpython.qpy3/files/lib/python3.6/site-packages/pydfs_lineup_optimizer/lineup_optimizer.py", line 384, in optimize solved_variables = solver.solve() File "/data/user/0/org.qpython.qpy3/files/lib/python3.6/site-packages/pydfs_lineup_optimizer/solvers/pulp_solver.py", line 46, in solve self.prob.solve(self.LP_SOLVER) File "/data/user/0/org.qpython.qpy3/files/lib/python3.6/site-packages/pulp/pulp.py", line 1737, in solve status = solver.actualSolve(self, kwargs) File "/data/user/0/org.qpython.qpy3/files/lib/python3.6/site-packages/pulp/apis/coin_api.py", line 101, in actualSolve return self.solve_CBC(lp, kwargs) File "/data/user/0/org.qpython.qpy3/files/lib/python3.6/site-packages/pulp/apis/coin_api.py", line 152, in solve_CBC cbc = subprocess.Popen(args, stdout = pipe, stderr = pipe, stdin=devnull) File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/subprocess.py", line 709, in init File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/subprocess.py", line 1344, in _execute_child OSError: [Errno 8] Exec format error: '/data/user/0/org.qpython.qpy3/files/lib/python3.6/site-packages/pulp/apis/../solverdir/cbc/linux/32/cbc' 1|:/ $

Denwen12 commented 3 years ago

post your code your running

cheez4 commented 3 years ago

from pydfs_lineup_optimizer import Site, Sport, get_optimizer optimizer = get_optimizer(Site.DRAFTKINGS, Sport.BASKETBALL) optimizer.load_players_from_csv("/storage/emulated/0/download/DKSal.csv") for lineup in optimizer.optimize(10): print(lineup)

Denwen12 commented 3 years ago

thats your whole code?

cheez4 commented 3 years ago

Yeah just using the example on the front page.. Do I need to write more code for it to work.. I appreciate you taking time to help me.

Denwen12 commented 3 years ago
import pulp
from pulp import COIN_CMD
import warnings
warnings.filterwarnings("ignore")
from collections import Counter
from itertools import chain
from pydfs_lineup_optimizer import get_optimizer, Site, Sport,CSVLineupExporter
from pydfs_lineup_optimizer.solvers.pulp_solver import PuLPSolver
from pydfs_lineup_optimizer.stacks import TeamStack, PositionsStack, PlayersGroup
from pydfs_lineup_optimizer import AfterEachExposureStrategy
from pydfs_lineup_optimizer.player import Player, GameInfo
from pydfs_lineup_optimizer.utils import list_intersection
import time
import datetime
from datetime import timezone
start_time = time.time()
class COIN_CMDSolver(PuLPSolver):
    LP_SOLVER = COIN_CMD(msg=0)
optimizer = get_optimizer(Site.DRAFTKINGS, Sport.BASKETBALL, solver=COIN_CMDSolver)
optimizer.load_players_from_csv("/storage/emulated/0/download/DKSal.csv")
for lineup in optimizer.optimize(10):
print(lineup)
Denwen12 commented 3 years ago

can you try that

Denwen12 commented 3 years ago

for that to work you need coin solver i stalled

cheez4 commented 3 years ago

Ok give me a moment

Denwen12 commented 3 years ago

i just fixed my coding and it should look like that

cheez4 commented 3 years ago

Wait how do I install coin solver

Denwen12 commented 3 years ago

try pip install -U git+https://github.com/coin-or/pulp

Denwen12 commented 3 years ago

do you have pulp installed

if not run pip install pulp

cheez4 commented 3 years ago

Yeah pulp is installed

cheez4 commented 3 years ago

/data/user/0/org.qpython.qpy3/files/bin/qpython3-android5.sh /storage/emulated/0/qpython/projects3/Dk/.last_tmp.py && exit jects3/Dk/.last_tmp.py && exit < File "/storage/emulated/0/qpython/projects3/Dk/.last_tmp.py", line 3 import warnings warnings.filterwarnings("ignore") ^ SyntaxError: invalid syntax 1|:/ $

Denwen12 commented 3 years ago

install warnings

On Mon, Jan 25, 2021, 5:23 PM cheez4 notifications@github.com wrote:

/data/user/0/org.qpython.qpy3/files/bin/qpython3-android5.sh /storage/emulated/0/qpython/projects3/Dk/.last_tmp.py && exit jects3/Dk/.last_tmp.py && exit < File "/storage/emulated/0/qpython/projects3/Dk/.last_tmp.py", line 3 import warnings warnings.filterwarnings("ignore") ^ SyntaxError: invalid syntax 1|:/ $

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/237#issuecomment-767152983, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7WBI2P3DFNTIXSFFXTS3XVPLANCNFSM4WRDT3EA .

Denwen12 commented 3 years ago

pip install pytest-warnings

On Mon, Jan 25, 2021, 9:33 PM joseph offen joffen12@gmail.com wrote:

install warnings

On Mon, Jan 25, 2021, 5:23 PM cheez4 notifications@github.com wrote:

/data/user/0/org.qpython.qpy3/files/bin/qpython3-android5.sh /storage/emulated/0/qpython/projects3/Dk/.last_tmp.py && exit jects3/Dk/.last_tmp.py && exit < File "/storage/emulated/0/qpython/projects3/Dk/.last_tmp.py", line 3 import warnings warnings.filterwarnings("ignore") ^ SyntaxError: invalid syntax 1|:/ $

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/237#issuecomment-767152983, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7WBI2P3DFNTIXSFFXTS3XVPLANCNFSM4WRDT3EA .

sansbacon commented 3 years ago

I'm skeptical this will work on android, but can you post the results of the following?

import pulp

print(pulp.listSolvers(onlyAvailable=True))

PuLP works by generating a solution file that is then read by a solver library. From the traceback, it looks like there is an error in how PuLP is trying to invoke the solver to read the file on your platform.