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:
JavaScript Tutorial Learn JavaScript TutorialOur JavaScript Tutorial is designed for beginners and professionals both. JavaScript is used to create client… Read More
DBMS Tutorial DBMS TutorialDBMS Tutorial provides basic and advanced concepts of Database. Our DBMS Tutorial is designed for beginners and professionals … Read More
Admin Session Lifetime | Adobe Commerce 2.4This article shows how you can increase the admin login session lifetime in Magento 2.ProblemWhen you are a developer, it is frustrating to login to a… Read More
jQuery Tutorial jQuery tutorial for beginners and professionals provides deep knowledge of jQuery technology. Our jQuery tutorial will help you to learn jQuery … Read More
Laravel package for the Google Translate API Laravel Google Translate is a package that provides an artisan console command to translate your localization files with the Google translation … Read More
0 comments:
Post a Comment
Thanks