Urban-Analytics / RAMP-UA

https://urban-analytics.github.io/RAMP-UA/
MIT License
15 stars 10 forks source link

Inconsistent environment #160

Closed nickmalleson closed 3 years ago

nickmalleson commented 4 years ago

Hi Alex,

This may be nothing important. I need to install the glfw package to use the new notebook (https://github.com/Urban-Analytics/RAMP-UA/issues/159) but got a warning from conda about an 'inconsistent environment'.

Could you have a quick look to see if it's something we need to worrk about?

$ conda install -c conda-forge glfw
Collecting package metadata (current_repodata.json): done
Solving environment: \ 
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - conda-forge/osx-64::pyopencl==2020.2.2=py37hc4fef25_0
done

## Package Plan ##

  environment location: /Users/nick/opt/anaconda3/envs/ramp-ua

  added / updated specs:
    - glfw

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    certifi-2020.6.20          |   py37h2987424_2         151 KB  conda-forge
    glfw-3.3.2                 |       h0b31af3_1         109 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         259 KB

The following NEW packages will be INSTALLED:

  appdirs            conda-forge/noarch::appdirs-1.4.3-py_1
  glfw               conda-forge/osx-64::glfw-3.3.2-h0b31af3_1
  pytools            conda-forge/noarch::pytools-2020.4-pyh9f0ad1d_0

The following packages will be UPDATED:

  certifi                          2020.6.20-py37hc8dfbb8_0 --> 2020.6.20-py37h2987424_2
github-actions[bot] commented 4 years ago

Branch Sparrow0hawk-issue-160-Inconsistent_environment created!

Sparrow0hawk commented 4 years ago

Hmm I wouldn't expect you to need to install glfw as its included in the opencl models requirements.txt and our conda environment file installs all the opencl dependencies.

If you activate the conda environment and do pip list is glfw not present there?

nickmalleson commented 4 years ago

Ah yes, it is there. I've dug further and it actually looks like it's weird behaviour caused by jupyter lab. If I open the notebook with jupyer notebook the libraries are opened without issue but with the lab I get missing libraries. I think it's probably something to do with my local setup, I'll experiment further. Anyway I'll close this now, thanks.

nickmalleson commented 4 years ago

P.S. @Sparrow0hawk it turns out that I didn't have jupyter-lab installed in the ramp-ua environment, so it was loading it from somewhere else. No idea where my console was finding it. Anyway I've installed it so it's fine now (I didn't include jupyer-lab in the environment file because I figured it would bloat it).

ciupava commented 3 years ago

hi @nickmalleson and @Sparrow0hawk, I seem to run in the same issue, ie I miss the glfw package. It is listed in the pip listoutput in terminal (with ramp-ua environment activated) but I can't see it listed in PyCHarm - Preferences - Python interpreter. No problem at the moment, for what I need now I could just run the model without OpenCL, but still not clear why this is happening, and potentially I might run into similar issues with other packages.

ciupava commented 3 years ago

Update: Apparently I have the same issue with the package imgui. Checking pip list output though I can see that both have pypi rather than conda-forge as the rest of the packages, in the column channel (see image below). Will try to fix that.

screenshot_pypi
Sparrow0hawk commented 3 years ago

@ciupava so for the opencl model we handle some of their dependencies via pip.

When you ran conda env create -f environment.yml to create the ramp-ua conda environment what output did you get?

Could you also run conda info and paste the output in this thread?

ciupava commented 3 years ago
conda info 

     active environment : ramp-ua
    active env location : /usr/local/anaconda3/envs/ramp-ua
            shell level : 2
       user config file : /Users/azanchetta/.condarc
 populated config files : /Users/azanchetta/.condarc
          conda version : 4.9.2
    conda-build version : 3.20.5
         python version : 3.8.5.final.0
       virtual packages : __osx=10.15.7=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /usr/local/anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /usr/local/anaconda3/pkgs
                          /Users/azanchetta/.conda/pkgs
       envs directories : /usr/local/anaconda3/envs
                          /Users/azanchetta/.conda/envs
               platform : osx-64
             user-agent : conda/4.9.2 requests/2.24.0 CPython/3.8.5 Darwin/19.6.0 OSX/10.15.7
                UID:GID : 503:20
             netrc file : None
           offline mode : False
ciupava commented 3 years ago

Not sure about the output of the creation of the ramp-ua environment... any hint on what you are trying to look for? I don't remember any error...

Sparrow0hawk commented 3 years ago

Okay so it created the environment as expected?

What steps did you do to trigger the inconsistent environment warning? I'll try and replicate this tomorrow.

ciupava commented 3 years ago

I would think that the environment was created properly, I can see the packages list etc. It seems to me clearly connected with that pipy value in the Channel column. Thanks for this, I will also try to look more into the matter this morning.

My steps are: created a project in PyCharm using the main.py and the rest of the folders cloned from the GItHub repo (I have created a copy in another location so I could mess around), then run the script main directly from the 'play' button within PyCharm.

I get the following:

/Users/azanchetta/opt/anaconda3/envs/ramp-ua/bin/python /Users/azanchetta/Research/projects/ramp_project/microsim/main.py
Traceback (most recent call last):
  File "/Users/azanchetta/Research/projects/ramp_project/microsim/main.py", line 27, in <module>
    from microsim.opencl.ramp.run import run_opencl
  File "/Users/azanchetta/Research/projects/ramp_project/microsim/opencl/ramp/run.py", line 6, in <module>
    from microsim.opencl.ramp.inspector import Inspector
  File "/Users/azanchetta/Research/projects/ramp_project/microsim/opencl/ramp/inspector.py", line 1, in <module>
    import glfw
ModuleNotFoundError: No module named 'glfw'

Process finished with exit code 1

As you can see, it also can't find the functions from within the folder opencl.

jabrams23 commented 3 years ago

Hey. You are using a Mac correct? What version of macOS do you have? Big Sur?

On 29. Jan 2021, at 08:56, annazan notifications@github.com wrote:

 I would think that the environment was created properly, I can see the packages list etc. It seems to me clearly connected with that pipy value in the Channel column. Thanks for this, I will also try to look more into the matter this morning.

My steps are: created a project in PyCharm using the main.py and the rest of the folders cloned from the GItHub repo (I have created a copy in another location so I could mess around), then run the script main directly from the 'play' button within PyCharm.

I get the following:

/Users/azanchetta/opt/anaconda3/envs/ramp-ua/bin/python /Users/azanchetta/Research/projects/ramp_project/microsim/main.py Traceback (most recent call last): File "/Users/azanchetta/Research/projects/ramp_project/microsim/main.py", line 27, in from microsim.opencl.ramp.run import run_opencl File "/Users/azanchetta/Research/projects/ramp_project/microsim/opencl/ramp/run.py", line 6, in from microsim.opencl.ramp.inspector import Inspector File "/Users/azanchetta/Research/projects/ramp_project/microsim/opencl/ramp/inspector.py", line 1, in import glfw ModuleNotFoundError: No module named 'glfw' As you can see, it also can't find the functions from within the folder opencl.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ciupava commented 3 years ago

Mac, yes. Version Catalina 10.15.7

jabrams23 commented 3 years ago

Ah ok. There were some OpenGL problems that cropped up after upgrading to Big Sur but that doesn’t seem to be it.

On 29. Jan 2021, at 09:03, annazan notifications@github.com wrote:

 Mac, yes. Version Catalina.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Sparrow0hawk commented 3 years ago

@ciupava if you open a regular bash terminal navigate to the RAMP-UA directory and do

conda activate ramp-ua

python microsim/main.py

Do you get the same error?

ciupava commented 3 years ago

Ok, I tried, I don't get the same error, apparently from terminal it is working (yeeeeh). Which actually makes sense, because the package is missing only in the PyCharm list. I will try to recreate the environment and then the interpreter/list of packages in PyCharm now.

Sparrow0hawk commented 3 years ago

@ciupava OK thought this might be the case, it will be to do with how PyCharm is configuring the python environment within PyCharm and potentially defaulting to running in a different environment to the ramp-ua environment. I'm not sure if the docs here help.

To be honest i'm not a PyCharm user (VSCode is my preferred editor) by maybe @nickmalleson can weigh in?

ciupava commented 3 years ago

Yep, thanks and don't worry, I think you did a lot already. The reason why I reopened the issue was that it might be relevant for others or connected with the code, but apparently it's just an editor matter. I will investigate and get back when I have some updates, hopefully.

nickmalleson commented 3 years ago

I think Alex mentioned this, but you need to tell PyCharm which python environment to use (ramp-ua in this case). It will default to using something else

ciupava commented 3 years ago

Hi Nick, maybe it wasn't clear from what I wrote before, but I did select the environment ramp-ua from PyCharm (PyCharm/Preferences/Interpreter) and in fact all the packages are listed there but the ones that from terminal have value pypi under Channel (all the rest have value conda-forge, see my screenshot above).

ciupava commented 3 years ago

Found this thread, it seems it might solve the issue

ciupava commented 3 years ago

Solved by playing around with the interpreter settings in PyCharm, see picture:

SolvedPyCharm

I have created a new environment (here you see it as an existing one, because it's already created) from within PyCharm and it solved the issue (I think before I was using an existing one I created in the terminal). Not sure then what was wrong but if it happens to someone else, worth trying playing around with the options here. Thanks for your help everyone.

nickmalleson commented 3 years ago

Excellent! Nice one @ciupava