DLTFpT icon indicating copy to clipboard operation
DLTFpT copied to clipboard

MarkupSafe problem

Open caboodle opened this issue 3 years ago • 6 comments

I am getting the following message when starting the container. The prescribed fix is to downgrade the markupsafe version to 2.0.1, which will not work due to werkzeug 2.2.2 has requirement MarkupSafe>=2.1.1, but you'll have markupsafe 2.0.1 which is incompatible

  File "/opt/conda/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line 41, in <module>
    from jinja2 import Environment, FileSystemLoader
  File "/opt/conda/lib/python3.7/site-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/opt/conda/lib/python3.7/site-packages/jinja2/environment.py", line 15, in <module>
    from jinja2 import nodes
  File "/opt/conda/lib/python3.7/site-packages/jinja2/nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "/opt/conda/lib/python3.7/site-packages/jinja2/utils.py", line 647, in <module>
    from markupsafe import Markup, escape, soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/opt/conda/lib/python3.7/site-packages/markupsafe/__init__.py)

Host system is Ubuntu 20.04.5 LTS.

caboodle avatar Sep 21 '22 07:09 caboodle

Hi @caboodle!

Confirming that you are using the Dockerfile here including the jupyter/scipy-notebook:2ce7c06a61a1 base image?

jonkrohn avatar Sep 21 '22 15:09 jonkrohn

Confirmed. (FROM jupyter/scipy-notebook:2ce7c06a61a1 )

I have only cloned the project about 30 min before posting this issue.

caboodle avatar Sep 22 '22 07:09 caboodle

Huh geez. That is a headscratcher, @caboodle. I'm not able to replicate the issue; the image builds perfectly for me (on both Mac OS and Ubuntu 16.04).

Probably not what you're looking to achieve here, but an alternative would be to work through the notebooks in the cloud (in Google Colab) instead of locally.

jonkrohn avatar Sep 22 '22 18:09 jonkrohn

I can build the image fine, but it will not start, (using rundocker.sh)

Executing the command: jupyter notebook
Traceback (most recent call last):
  File "/opt/conda/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line 41, in <module>
    from jinja2 import Environment, FileSystemLoader
  File "/opt/conda/lib/python3.7/site-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/opt/conda/lib/python3.7/site-packages/jinja2/environment.py", line 15, in <module>
    from jinja2 import nodes
  File "/opt/conda/lib/python3.7/site-packages/jinja2/nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "/opt/conda/lib/python3.7/site-packages/jinja2/utils.py", line 647, in <module>
    from markupsafe import Markup, escape, soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/opt/conda/lib/python3.7/site-packages/markupsafe/__init__.py)

Apparently markupsafe is not longer supplying soft_unicode as per this issue: https://github.com/pallets/markupsafe/issues/304

Google Colab is not an option when it comes to company data, I'm afraid. For the LiveLessions it's fine though.

Conda + DataSpell should also do the trick.

caboodle avatar Sep 23 '22 06:09 caboodle

I can build the image fine, but it will not start, (using rundocker.sh)

Executing the command: jupyter notebook
Traceback (most recent call last):
  File "/opt/conda/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/opt/conda/lib/python3.7/site-packages/notebook/notebookapp.py", line 41, in <module>
    from jinja2 import Environment, FileSystemLoader
  File "/opt/conda/lib/python3.7/site-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/opt/conda/lib/python3.7/site-packages/jinja2/environment.py", line 15, in <module>
    from jinja2 import nodes
  File "/opt/conda/lib/python3.7/site-packages/jinja2/nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "/opt/conda/lib/python3.7/site-packages/jinja2/utils.py", line 647, in <module>
    from markupsafe import Markup, escape, soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/opt/conda/lib/python3.7/site-packages/markupsafe/__init__.py)

Apparently markupsafe is not longer supplying soft_unicode as per this issue: pallets/markupsafe#304

Google Colab is not an option when it comes to company data, I'm afraid. For the LiveLessions it's fine though.

Conda + DataSpell should also do the trick.

Hi! I'm also facing the same issue. I'm using Mac m1 and can't figure out how to deal with this issue. This is my first project.

Mahrukhw avatar Oct 06 '22 20:10 Mahrukhw

Ok thanks @caboodle and @Mahrukhw. This seems to be a major issue. Will test on my M1 Mac and hope to resolve the issue soon.

jonkrohn avatar Oct 06 '22 23:10 jonkrohn

Hi @caboodle and @Mahrukhw — this issue is related to version library dependencies that have changed over time.

There is not an easy way for me to fix it by updating the Dockerfile, so instead I've uploaded a Docker image that should work for you to DockerHub here.

If either (or better yet both!) of you could please confirm that pulling the docker image with docker pull jonkrohn/dltfpt-stack:videos works for you (instead of building the image from the Dockerfile), then I'll update the "official" install instructions for this repo to have everyone pull from DockerHub instead of building the image themselves.

jonkrohn avatar Oct 17 '22 01:10 jonkrohn

Hi! I had the same problem ImportError: cannot import name 'soft_unicode' from 'markupsafe'. I'm running a Intel MacBook Pro. I downloaded the docker image (docker pull jonkrohn/dltfpt-stack:videos) and I worked just fine.

brauliomsft avatar Oct 28 '22 21:10 brauliomsft

Ok awesome @brauliomsft — that's great news :D

I'll update the installation instructions in this repo shortly to focus on using the Docker image instead of the Dockerfile.

jonkrohn avatar Nov 12 '22 23:11 jonkrohn

I had the same problem on a MacBook with M1 chip and with jonkrohn/dltfpt-stack:videos works fine

albertoforni avatar Nov 30 '22 22:11 albertoforni

Ok super duper @albertoforni! Glad it worked for you too. I've been slammed lately but hope to update the install instructions in this repo with the Docker image soon.

jonkrohn avatar Dec 02 '22 01:12 jonkrohn

Ok I've updated Step 8 of the macOS instructions to reflect pulling the Docker image instead of building it locally.

I'd appreciate if @albertoforni or @brauliomsft could confirm these updated instructions look solid.

@caboodle or @Mahrukhw -- if you're still experiencing this issue, could you please try the updated install instructions? Looking forward to hearing how they go for you!

jonkrohn avatar Dec 27 '22 02:12 jonkrohn

Ok I've updated Step 8 of the macOS instructions to reflect pulling the Docker image instead of building it locally.

I'd appreciate if @albertoforni or @brauliomsft could confirm these updated instructions look solid.

@caboodle or @Mahrukhw -- if you're still experiencing this issue, could you please try the updated install instructions? Looking forward to hearing how they go for you!

@jonkrohn You may want to change step 9 as well. Command is still running dltfpt-stack, and the build command is removed. So I'm assuming we need to run jonkrohn/dltfpt-stack:videos. Thanks!

Karthikvishw avatar Dec 28 '22 07:12 Karthikvishw

You are quite right, @Karthikvishw — thank you! I've updated Step 9 accordingly now and the instructions work properly 🙏

jonkrohn avatar Dec 29 '22 03:12 jonkrohn