ese-msc / introduction-to-python

"Introduction to Python" course for future Imperial College London MSc students
BSD 3-Clause "New" or "Revised" License
75 stars 94 forks source link

Python Module Installation Issue #52

Closed edsml-cg1123 closed 1 year ago

edsml-cg1123 commented 1 year ago

Hello! I have started working on the first assignment on a macbook pro (early 2015). Whilst running the very first cell, I get the error: ModuleNotFoundError: No module named 'pybryt' I have tried inline !pip install pybryt as shown in the image below

Screenshot 2023-08-22 at 3 20 28 PM

However, the error still persists. I'm not quite sure what I'm missing here, since the pip installation happened successfully.

marijanbeg commented 1 year ago

Hi @edsml-72da475c, thank you for raising the issue. Have you created the conda environment and installed all dependencies (step 3 in installation instructions). Also, please ensure you start Jupyter from the right conda environment.

edsml-cg1123 commented 1 year ago

Yes, I followed all the instructions in step 3. For reference, here is the result of the conda info command on the mac terminal

Chandrasekhars-MacBook-Pro:introduction-to-python gudipati$ conda info

     active environment : None
       user config file : /Users/gudipati/.condarc
 populated config files : /Users/gudipati/.condarc
          conda version : 23.7.2
    conda-build version : 3.26.0
         python version : 3.11.4.final.0
       virtual packages : __archspec=1=x86_64
                          __osx=10.16=0
                          __unix=0=0
       base environment : /Users/gudipati/anaconda3  (writable)
      conda av data dir : /Users/gudipati/anaconda3/etc/conda
  conda av metadata url : None
           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 : /Users/gudipati/anaconda3/pkgs
                          /Users/gudipati/.conda/pkgs
       envs directories : /Users/gudipati/anaconda3/envs
                          /Users/gudipati/.conda/envs
               platform : osx-64
             user-agent : conda/23.7.2 requests/2.31.0 CPython/3.11.4 Darwin/21.6.0 OSX/10.16
                UID:GID : 501:20
             netrc file : None
           offline mode : False

For more context, here are chunks of the code I used for step 3

Chandrasekhars-MacBook-Pro:~ gudipati$ echo 'PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
Chandrasekhars-MacBook-Pro:~ gudipati$ brew doctor
Your system is ready to brew.
Chandrasekhars-MacBook-Pro:~ gudipati$ brew install git
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
##O#- #                                                                        
==> Fetching dependencies for git: gettext and pcre2
==> Fetching gettext
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.21.1
######################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/blobs/sha256:9318777367
######################################################################### 100.0%
==> Fetching pcre2
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/manifests/10.42
######################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/blobs/sha256:76ccbd45954e
######################################################################### 100.0%
==> Fetching git
==> Downloading https://ghcr.io/v2/homebrew/core/git/manifests/2.41.0_2-1
######################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/git/blobs/sha256:36cb8b459b3ac1
######################################################################### 100.0%
==> Installing dependencies for git: gettext and pcre2
==> Installing git dependency: gettext
==> Pouring gettext--0.21.1.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/gettext/0.21.1: 1,983 files, 20.6MB
==> Installing git dependency: pcre2
==> Pouring pcre2--10.42.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/pcre2/10.42: 230 files, 6.4MB
==> Installing git
==> Pouring git--2.41.0_2.monterey.bottle.1.tar.gz
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
Subversion interoperability (git-svn) is now in the `git-svn` formula.

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/git/2.41.0_2: 1,633 files, 48.8MB
==> Running `brew cleanup git`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> git
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
Subversion interoperability (git-svn) is now in the `git-svn` formula.
Chandrasekhars-MacBook-Pro:Desktop gudipati$ cd '/Users/gudipati/Desktop/Imperial College London/Pre Course Tasks'
Chandrasekhars-MacBook-Pro:Pre Course Tasks gudipati$ git clone https://github.com/ese-msc/introduction-to-python
Cloning into 'introduction-to-python'...
remote: Enumerating objects: 367, done.
remote: Counting objects: 100% (215/215), done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 367 (delta 134), reused 149 (delta 117), pack-reused 152
Receiving objects: 100% (367/367), 458.23 KiB | 2.73 MiB/s, done.
Resolving deltas: 100% (216/216), done.
Chandrasekhars-MacBook-Pro:Pre Course Tasks gudipati$ cd '/Users/gudipati/Desktop/Imperial College London/Pre Course Tasks/introduction-to-python'
Chandrasekhars-MacBook-Pro:introduction-to-python gudipati$ conda env create -f environment.yml
Collecting package metadata (repodata.json): done
Solving environment: done
Chandrasekhars-MacBook-Pro:introduction-to-python gudipati$ source activate introduction-to-python
(introduction-to-python) Chandrasekhars-MacBook-Pro:introduction-to-python gudipati$ jupyter notebook &
[1] 23050
marijanbeg commented 1 year ago

Could you please send us the output of the following two commands in your terminal:

conda list
pip freeze
edsml-cg1123 commented 1 year ago

Please find the outputs of the commands conda list and pip freeze below

conda list
# packages in environment at /Users/gudipati/anaconda3/envs/introduction-to-python:
#
# Name                    Version                   Build  Channel
anyio                     3.7.1                    pypi_0    pypi
appnope                   0.1.3                    pypi_0    pypi
argon2-cffi               23.1.0                   pypi_0    pypi
argon2-cffi-bindings      21.2.0                   pypi_0    pypi
arrow                     1.2.3                    pypi_0    pypi
asttokens                 2.2.1                    pypi_0    pypi
astunparse                1.6.3                    pypi_0    pypi
async-lru                 2.0.4                    pypi_0    pypi
attrs                     23.1.0                   pypi_0    pypi
babel                     2.12.1                   pypi_0    pypi
backcall                  0.2.0                    pypi_0    pypi
beautifulsoup4            4.12.2                   pypi_0    pypi
bleach                    6.0.0                    pypi_0    pypi
bzip2                     1.0.8                h1de35cc_0  
ca-certificates           2023.05.30           hecd8cb5_0  
certifi                   2023.7.22                pypi_0    pypi
cffi                      1.15.1                   pypi_0    pypi
charset-normalizer        3.2.0                    pypi_0    pypi
click                     8.1.7                    pypi_0    pypi
comm                      0.1.4                    pypi_0    pypi
contourpy                 1.1.0                    pypi_0    pypi
cycler                    0.11.0                   pypi_0    pypi
cython                    3.0.0                    pypi_0    pypi
debugpy                   1.6.7.post1              pypi_0    pypi
decorator                 5.1.1                    pypi_0    pypi
defusedxml                0.7.1                    pypi_0    pypi
dill                      0.3.7                    pypi_0    pypi
exceptiongroup            1.1.3                    pypi_0    pypi
executing                 1.2.0                    pypi_0    pypi
fastjsonschema            2.18.0                   pypi_0    pypi
fonttools                 4.42.1                   pypi_0    pypi
fqdn                      1.5.1                    pypi_0    pypi
idna                      3.4                      pypi_0    pypi
iniconfig                 2.0.0                    pypi_0    pypi
ipykernel                 6.25.1                   pypi_0    pypi
ipython                   8.14.0                   pypi_0    pypi
isoduration               20.11.0                  pypi_0    pypi
jedi                      0.19.0                   pypi_0    pypi
jinja2                    3.1.2                    pypi_0    pypi
json5                     0.9.14                   pypi_0    pypi
jsonpointer               2.4                      pypi_0    pypi
jsonschema                4.19.0                   pypi_0    pypi
jsonschema-specifications 2023.7.1                 pypi_0    pypi
jupyter-client            8.3.0                    pypi_0    pypi
jupyter-core              5.3.1                    pypi_0    pypi
jupyter-events            0.7.0                    pypi_0    pypi
jupyter-lsp               2.2.0                    pypi_0    pypi
jupyter-server            2.7.2                    pypi_0    pypi
jupyter-server-terminals  0.4.4                    pypi_0    pypi
jupyterlab                4.0.5                    pypi_0    pypi
jupyterlab-pygments       0.2.2                    pypi_0    pypi
jupyterlab-server         2.24.0                   pypi_0    pypi
kiwisolver                1.4.4                    pypi_0    pypi
libffi                    3.4.4                hecd8cb5_0  
markupsafe                2.1.3                    pypi_0    pypi
matplotlib                3.7.2                    pypi_0    pypi
matplotlib-inline         0.1.6                    pypi_0    pypi
mistune                   3.0.1                    pypi_0    pypi
nbclient                  0.8.0                    pypi_0    pypi
nbconvert                 7.7.4                    pypi_0    pypi
nbformat                  5.9.2                    pypi_0    pypi
ncurses                   6.4                  hcec6c5f_0  
nest-asyncio              1.5.7                    pypi_0    pypi
notebook-shim             0.2.3                    pypi_0    pypi
numpy                     1.25.2                   pypi_0    pypi
okpy                      1.7.2                    pypi_0    pypi
openssl                   3.0.10               hca72f7f_0  
overrides                 7.4.0                    pypi_0    pypi
packaging                 23.1                     pypi_0    pypi
pandas                    2.0.3                    pypi_0    pypi
pandocfilters             1.5.0                    pypi_0    pypi
parso                     0.8.3                    pypi_0    pypi
pendulum                  2.1.2                    pypi_0    pypi
pexpect                   4.8.0                    pypi_0    pypi
pickleshare               0.7.5                    pypi_0    pypi
pillow                    10.0.0                   pypi_0    pypi
pip                       23.2.1          py310hecd8cb5_0  
platformdirs              3.10.0                   pypi_0    pypi
pluggy                    1.2.0                    pypi_0    pypi
prometheus-client         0.17.1                   pypi_0    pypi
prompt-toolkit            3.0.39                   pypi_0    pypi
psutil                    5.9.5                    pypi_0    pypi
ptyprocess                0.7.0                    pypi_0    pypi
pure-eval                 0.2.2                    pypi_0    pypi
pybryt                    0.7.0                    pypi_0    pypi
pycparser                 2.21                     pypi_0    pypi
pygments                  2.16.1                   pypi_0    pypi
pyparsing                 3.0.9                    pypi_0    pypi
pytest                    7.4.0                    pypi_0    pypi
python                    3.10.12              h5ee71fb_0  
python-dateutil           2.8.2                    pypi_0    pypi
python-json-logger        2.0.7                    pypi_0    pypi
pytz                      2023.3                   pypi_0    pypi
pytzdata                  2020.1                   pypi_0    pypi
pyyaml                    6.0.1                    pypi_0    pypi
pyzmq                     25.1.1                   pypi_0    pypi
readline                  8.2                  hca72f7f_0  
referencing               0.30.2                   pypi_0    pypi
requests                  2.31.0                   pypi_0    pypi
rfc3339-validator         0.1.4                    pypi_0    pypi
rfc3986-validator         0.1.1                    pypi_0    pypi
rpds-py                   0.9.2                    pypi_0    pypi
send2trash                1.8.2                    pypi_0    pypi
setuptools                68.0.0          py310hecd8cb5_0  
six                       1.16.0                   pypi_0    pypi
sniffio                   1.3.0                    pypi_0    pypi
soupsieve                 2.4.1                    pypi_0    pypi
sqlite                    3.41.2               h6c40b1e_0  
stack-data                0.6.2                    pypi_0    pypi
terminado                 0.17.1                   pypi_0    pypi
tinycss2                  1.2.1                    pypi_0    pypi
tk                        8.6.12               h5d9f67b_0  
tomli                     2.0.1                    pypi_0    pypi
tornado                   6.3.3                    pypi_0    pypi
traitlets                 5.9.0                    pypi_0    pypi
typing-extensions         4.7.1                    pypi_0    pypi
tzdata                    2023.3                   pypi_0    pypi
uri-template              1.3.0                    pypi_0    pypi
urllib3                   2.0.4                    pypi_0    pypi
wcwidth                   0.2.6                    pypi_0    pypi
webcolors                 1.13                     pypi_0    pypi
webencodings              0.5.1                    pypi_0    pypi
websocket-client          1.6.1                    pypi_0    pypi
wheel                     0.38.4          py310hecd8cb5_0  
xz                        5.4.2                h6c40b1e_0  
zlib                      1.2.13               h4dc903c_0
(introduction-to-python) Chandrasekhars-MacBook-Pro:introduction-to-python gudipati$ pip freeze
anyio==3.7.1
appnope==0.1.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.2.3
asttokens==2.2.1
astunparse==1.6.3
async-lru==2.0.4
attrs==23.1.0
Babel==2.12.1
backcall==0.2.0
beautifulsoup4==4.12.2
bleach==6.0.0
certifi==2023.7.22
cffi==1.15.1
charset-normalizer==3.2.0
click==8.1.7
comm==0.1.4
contourpy==1.1.0
cycler==0.11.0
Cython==3.0.0
debugpy==1.6.7.post1
decorator==5.1.1
defusedxml==0.7.1
dill==0.3.7
exceptiongroup==1.1.3
executing==1.2.0
fastjsonschema==2.18.0
fonttools==4.42.1
fqdn==1.5.1
idna==3.4
iniconfig==2.0.0
ipykernel==6.25.1
ipython==8.14.0
isoduration==20.11.0
jedi==0.19.0
Jinja2==3.1.2
json5==0.9.14
jsonpointer==2.4
jsonschema==4.19.0
jsonschema-specifications==2023.7.1
jupyter-events==0.7.0
jupyter-lsp==2.2.0
jupyter_client==8.3.0
jupyter_core==5.3.1
jupyter_server==2.7.2
jupyter_server_terminals==0.4.4
jupyterlab==4.0.5
jupyterlab-pygments==0.2.2
jupyterlab_server==2.24.0
kiwisolver==1.4.4
MarkupSafe==2.1.3
matplotlib==3.7.2
matplotlib-inline==0.1.6
mistune==3.0.1
nbclient==0.8.0
nbconvert==7.7.4
nbformat==5.9.2
nest-asyncio==1.5.7
notebook_shim==0.2.3
numpy==1.25.2
okpy==1.7.2
overrides==7.4.0
packaging==23.1
pandas==2.0.3
pandocfilters==1.5.0
parso==0.8.3
pendulum==2.1.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==10.0.0
platformdirs==3.10.0
pluggy==1.2.0
prometheus-client==0.17.1
prompt-toolkit==3.0.39
psutil==5.9.5
ptyprocess==0.7.0
pure-eval==0.2.2
pybryt==0.7.0
pycparser==2.21
Pygments==2.16.1
pyparsing==3.0.9
pytest==7.4.0
python-dateutil==2.8.2
python-json-logger==2.0.7
pytz==2023.3
pytzdata==2020.1
PyYAML==6.0.1
pyzmq==25.1.1
referencing==0.30.2
requests==2.31.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.9.2
Send2Trash==1.8.2
six==1.16.0
sniffio==1.3.0
soupsieve==2.4.1
stack-data==0.6.2
terminado==0.17.1
tinycss2==1.2.1
tomli==2.0.1
tornado==6.3.3
traitlets==5.9.0
typing_extensions==4.7.1
tzdata==2023.3
uri-template==1.3.0
urllib3==2.0.4
wcwidth==0.2.6
webcolors==1.13
webencodings==0.5.1
websocket-client==1.6.1
marijanbeg commented 1 year ago

From the output you sent us, PyBryt is installed. Could you please ensure you start the notebook from the right conda environment?

edsml-cg1123 commented 1 year ago

I have a fix that is working at least for now:

The code seems to be working if i simply replace !pip install pybryt with %pip install pybryt. I don't fully understand why this fixes the problem, but my best guess is that it might have something to do with the location where the module files are being installed. In the case of %pip install, the files are being saved in the same location as the sys.executable address. This is not the case with !pip install. I will update this thread in case there are further complications within the same issue, especially if pybryt has issues with detecting my errors, but I believe this should be a viable solution.

Thank you so much for helping me out @marijanbeg ! I am super excited to get started with the exercises!!!

marijanbeg commented 1 year ago

Thank you for letting us know @edsml-72da475c.