SEN1221TUD / Q2_2024

0 stars 0 forks source link

Can't import Biogeme #2

Open Kurtvanpelt opened 1 week ago

Kurtvanpelt commented 1 week ago

I tried to import biogeme , but I got the error:no module called biogeme. I think something went wrong with the installation of the requirement text (see error). I don't understand what the issue is here. I think I have installed the newest juptiper lab, but I am not sure where I can find that. Can you help me solving this issue

image

gnova3 commented 1 week ago

Hi!

It seems that you're having issues installing packages from the requirements.txt file due to Python version compatibility.

Could you please share the following:

  1. Which method are you using to set up your environment (Anaconda?)?
  2. Have you confirmed your Python version by running: !python --version

With this information, I can assist you better😊.

Kurtvanpelt commented 1 week ago

Hi,

I have used method 1, so by creating a environment in anaconda and then opening this in Juptitar Lab to do run this code.

For the second thing see the attachements image

gnova3 commented 1 week ago

Hi,

Since we have tested the requirements.txt on the Python versions specified in the instructions, the issue might be specific to your setup.

Let's try a few things:

  1. Create a new environment with Python 3.11.10: Please try creating a new environment in Anaconda following the instructions in 5.A. Setting up with Anaconda.

  2. Update Anaconda and Try Again: If the problem persists, update Anaconda itself, and then try creating the environment again with Python 3.11:

    • Close JupyterLab/JupyterNotebook, and open the Anaconda Prompt.
    • Run the following commands to update conda and Anaconda:
      conda update conda
      conda update anaconda
    • Create a new env using python 3.11.10

Gabriel

SilvesterdenBoer commented 1 week ago

I have the exact same problem, and i have changed my workspace to 3.11.10, but i cannot seem to update jupyter to use that same version. Any particular steps that have to be followed?

I changed worspace, downloaded the files again, closed jupyter and my browser. In my terminal it gives the right version, but when getting the version in jupyter it just does not update.

FGarridoV commented 1 week ago

Can you try installing biogeme using these command in cells:

First cell:

!python --version

Check the version is 3.11.x

Second cell:

!python -m pip install biogeme

Let me know if using this was the package is installed

SilvesterdenBoer commented 1 week ago

Okay so I maybe was not clear but I will show you what is wrong. My workspace is set to 3.11.10 as you can see by the print sys comment, but for some reason jupyter still uses 3.12. as its python version

Screenshot 2024-11-13 at 18 10 46

When running the instal for biogeme it goes a long way but still gives errors. Same for the installment of all stuff in the text file.

Screenshot 2024-11-13 at 18 14 00

using the update conda line does not work in jupyter

FGarridoV commented 1 week ago

Thank you for the clarification @SilvesterdenBoer. I think now I understood the issue. If I am not wrong is in the other way around:

When you do "pip install" in your terminal (Are you using macOS btw?), installs the packages in 3.12. It installs with errors, buton 3.12. So, when you run a cell, it runs from 3.11 which doesn't have biogeme.

Possible solutions:

SilvesterdenBoer commented 1 week ago

Got it! Thanks Francisco!

Kurtvanpelt commented 1 week ago

Thank you Gabriel for you explanation. When I create I new environment I still have the same issues. You said that I then must update my anaconda in anaconda prompt. What is the anaconda prompt exactly? I am trying this on MacOS.

gnova3 commented 1 week ago

Hi @Kurtvanpelt,

To update Anaconda on your Mac, please follow these steps in Terminal:

  1. Close JupyterLab if it’s open.
  2. Open the Terminal (you can find it in Applications).
  3. Run the following commands:

    
    conda update conda
    conda update anaconda

After updating, please try creating the environment again with Python 3.11.10. Then, launch JupyterLab directly from this environment, open the notebook, and run !python --version in the first cell of the lab file.

If everything works, run the cell to install the requirements: !pip install ../../requirements.txt

Let me know if this resolves the issue.

jvanhoeve commented 1 week ago

I solved it in the end by changing doing the following:

To edit the requirements.txt file to use a compatible version of torch, follow these steps:

Open requirements.txt: Locate and open the requirements.txt file in a text editor.

Find the Line with torch==2.3.1: Look for the line that specifies torch==2.3.1.

Edit the Version: Change torch==2.3.1 to torch==2.2.2, which is compatible with Python 3.11.10:

Kurtvanpelt commented 5 days ago

Thank you @jvanhoeve this actually works, so now I can run the notebook.

gnova3 commented 4 days ago

Hi @jvanhoeve

What type of machine do you have, windows, Mac intel, or Mac silicon? Did you use anaconda to install the requirements?

jvanhoeve commented 4 days ago

Hi,

I have an Macbook Pro with an intel chip. And used anaconda to install all the requirements

Kind regards,

Joppe van Hoeve

From: Gabriel Nova @.> Date: Monday, 18 November 2024 at 08:47 To: SEN1221TUD/Q2_2024 @.> Cc: jvanhoeve @.>, Mention @.> Subject: Re: [SEN1221TUD/Q2_2024] Can't import Biogeme (Issue #2)

Hi @jvanhoevehttps://github.com/jvanhoeve

What type of machine do you have, windows, Mac intel, or Mac silicon? Did you use anaconda to install the requirements?

— Reply to this email directly, view it on GitHubhttps://github.com/SEN1221TUD/Q2_2024/issues/2#issuecomment-2482179608, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BM62NY54AUJGDLJ5FJIFG2T2BGLQHAVCNFSM6AAAAABRUST6GWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBSGE3TSNRQHA. You are receiving this because you were mentioned.Message ID: @.***>