StanislavYatsevich / Store_Sales

The project is aimed at stores' sales prediction
0 stars 0 forks source link

No such file or directory error while running a script #6

Open astraszab opened 1 month ago

astraszab commented 1 month ago

I'm running splitting_and_preparing_data.py script as described in README: python splitting_and_preparing_data.py

Getting the following error: /home/astraszab/.pyenv/versions/3.12.3/bin/python: can't open file '/home/astraszab/projects/Store_Sales/splitting_and_preparing_data.py': [Errno 2] No such file or directory

StanislavYatsevich commented 1 month ago

Update README, make sure that you are trying to run it from the folder with splitting_and_preparing_data.py file.

astraszab commented 2 weeks ago

Thanks for the clarification. Now I'm getting another error:

~/projects/Store_Sales/src/store_sales$ python splitting_and_preparing_data.py

Traceback (most recent call last): File "/home/astraszab/projects/Store_Sales/src/store_sales/splitting_and_preparing_data.py", line 1, in import pandas as pd ModuleNotFoundError: No module named 'pandas'

astraszab commented 2 weeks ago

Also why the streamlit section is placed before dependencies installation in readme? Don't we need an environment created to run streamlit?

StanislavYatsevich commented 2 weeks ago

Also why the streamlit section is placed before dependencies installation in readme? Don't we need an environment created to run streamlit?

That's a good point, replaced the Streamlit section to the right place in README. b0d8fe3

StanislavYatsevich commented 2 weeks ago

Thanks for the clarification. Now I'm getting another error:

~/projects/Store_Sales/src/store_sales$ python splitting_and_preparing_data.py

Traceback (most recent call last): File "/home/astraszab/projects/Store_Sales/src/store_sales/splitting_and_preparing_data.py", line 1, in import pandas as pd ModuleNotFoundError: No module named 'pandas'

As I see your python can't find the Pandas module even though it's in pyproject.toml file and should have been installed by Poetry. Try activating virtual env by running 'poetry shell' command in your terminal. If there's still an error, make sure that Poetry dependencies and packages are installed. For doing this run 'poetry show' command in your terminal and check if Pandas library is there. Finally, you may try running scripts via using the 'poetry run' command (e.g poetry run python splitting_and_preparing_data.py instead of python splitting_and_preparing_data.py).

astraszab commented 2 weeks ago

The point is there are no instructions regarding activating the virtual env in the README, so subsequent commands after poetry install don't work, including streamlit and running python scripts directly via python command. Also consider using 'scripts' section of pyproject.toml. This will allow you to register specific scripts and use them as commands without navigating to the directories in src/ (https://python-poetry.org/docs/pyproject/#scripts)

StanislavYatsevich commented 2 weeks ago

The point is there are no instructions regarding activating the virtual env in the README, so subsequent commands after poetry install don't work, including streamlit and running python scripts directly via python command. Also consider using 'scripts' section of pyproject.toml. This will allow you to register specific scripts and use them as commands without navigating to the directories in src/ (https://python-poetry.org/docs/pyproject/#scripts)

Yes, you are right, thank you. Added more instructions to README for virtual environment activation. a927ba3

StanislavYatsevich commented 2 weeks ago

The point is there are no instructions regarding activating the virtual env in the README, so subsequent commands after poetry install don't work, including streamlit and running python scripts directly via python command. Also consider using 'scripts' section of pyproject.toml. This will allow you to register specific scripts and use them as commands without navigating to the directories in src/ (https://python-poetry.org/docs/pyproject/#scripts)

Added scripts in .toml ecc4d15 and 38f8e26