So I'm trying to run this docker container
FROM ubuntu:latest
RUN apt update
RUN apt install software-properties-common -y
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt install python3-pip -y
RUN apt-get remove swig
RUN apt-get install swig3.0
RUN ln -s /usr/bin/swig3.0 /usr/bin/swig
RUN pip3 install auto-sklearn
# During debugging, this entry point will be overridden. For more information, please refer to
https://aka.ms/vscode-docker-python-debug
/>
ADD . /test.py
WORKDIR /
CMD ["python3", "test.py"]
and I get the error "/usr/bin/python3: can't find 'main' module in 'test.py'" from Docker Desktop. There are other posts similar to this on Stack Overflow, but I made the appropriate changes and it still doesn't seem to work. My Python code is quite simple
import pandas as pd
import autosklearn.classification as classification
import sklearn.model_selection as model_selection
if __name__ == "__main__":
def split_train_val(self, X: pd.DataFrame, y: pd.DataFrame):
X_train, X_val, y_train, y_val = model_selection.train_test_split(
X, y, test_size=0.25)
return X_train, X_val, y_train.to_frame(), y_val.to_frame()
model = classification.AutoSklearnClassifier(
time_left_for_this_task=3600,
ensemble_size=1,
ensemble_nbest=1,
)
dataset = pd.read_csv('data.csv')
dataset = dataset.iloc[:100]
X, y = dataset.drop(columns=[target_col]), dataset[target_col]
self.model.fit(X, y)
print(self.model.cv_results_)
Running Python code in Docker gives: "/usr/bin/python3: can't find '__main__' module in 'test.py'"
Programing Coderfunda
March 05, 2024
No comments
Related Posts:
Jquery Checkbox check all<input type="checkbox" id="checkAll" > Check All <hr /> <input type="checkbox" id="checkItem"> I… Read More
25 PHP Interview Questions and Answers You Must KnowHere are some PHP questions and answers for experienced developers (with some beginner concepts covered). Do you need to test a developer's PHP s… Read More
Features CodeIgniterFeatures CodeIgniterThere is a great demand for the CodeIgniter framework in PHP developers because of its features and multiple advantages. The web a… Read More
Remove duplicates form CSV - PHP Coding Help<?php $filename = "file.csv"; $file = fopen($filename, "r"); $read = fread($file, filesize($filename)); $s… Read More
How to Import and Export CSV Files Using PHP and MySQL<?phpsession_start();error_reporting(0);include('includes/config.php');include('includes/sessionout.php');if(strlen($_SESSION['alogin'])==0) &… Read More
0 comments:
Post a Comment
Thanks