Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won't install on Windows #67

Closed
debnet opened this issue Mar 14, 2017 · 17 comments
Closed

Won't install on Windows #67

debnet opened this issue Mar 14, 2017 · 17 comments

Comments

@debnet
Copy link

debnet commented Mar 14, 2017

Python 3.6 (x86-64)
pip == 9.0.1
setuptools == 34.3.2

(no36) D:\Git\project>pip install --force --upgrade markupsafe
Collecting markupsafe
  Using cached MarkupSafe-1.0.tar.gz
Building wheels for collected packages: markupsafe
  Running setup.py bdist_wheel for markupsafe ... error
  Failed building wheel for markupsafe
  Running setup.py clean for markupsafe
Failed to build markupsafe
Installing collected packages: markupsafe
  Found existing installation: markupsafe 1.0
    Uninstalling markupsafe-1.0:
      Successfully uninstalled markupsafe-1.0
  Running setup.py install for markupsafe ... error
  Rolling back uninstall of markupsafe
Exception:
Traceback (most recent call last):
  File "d:\python\no36\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 66: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\python\no36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "d:\python\no36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "d:\python\no36\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "d:\python\no36\lib\site-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,
  File "d:\python\no36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "d:\python\no36\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 66: invalid continuation byte
@alorence
Copy link

alorence commented May 6, 2017

I have the same issue here, but since I was using MarkupSafe without problem on Windows when I worked with Python 3.5, I assume the error comes from Python 3.6. Maybe the title of this issue should be updated ?

@alorence
Copy link

alorence commented May 6, 2017

Actually, the problem seems to come from missing wheel for MarkupSafe on Pypi. Creating it manually solved the issue for me. Here is the workaround (I use git-bash on Windows):

git clone git@github.com:pallets/markupsafe.git /c/tmp/markupsafe
cd /c/tmp/markupsafe
./setup.py bdist_wheel

The result is a valid wheel: /c/tmp/markupsafe/dist/MarkupSafe-1.0-cp36-cp36m-win_amd64.whl.
In your other project where you need to use it, simply call

pip install /c/tmp/markupsafe/dist/MarkupSafe-1.0-cp36-cp36m-win_amd64.whl

And you're done

@Jiankai-Sun
Copy link

Jiankai-Sun commented May 30, 2017

Traceback (most recent call last):
  File "c:\users\ray\appdata\local\programs\python\python36\lib\site-packages\pip\compat\__init__.py", line 76, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 33: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\ray\appdata\local\programs\python\python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\users\ray\appdata\local\programs\python\python36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\users\ray\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\users\ray\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,
  File "c:\users\ray\appdata\local\programs\python\python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "c:\users\ray\appdata\local\programs\python\python36\lib\site-packages\pip\compat\__init__.py", line 78, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 33: invalid start byte

I had the same error with Python 3.6 on Windows 10 and @alorence's solution fixed it.

@MerleLiuKun
Copy link

I also meet this question, I found this is just a decode error. In my environment, the console's coding is 'gbk', and this return s.decode('utf-8'). so it make error. when I modify the source code to s.decode('gbk'). It works.

@cointoss1973
Copy link

I investigated using the git bisect command.
It was found that it was corrected by the following modified commit of pip.
pypa/pip@8a10132

@elpocoburrito
Copy link

elpocoburrito commented Nov 21, 2017

In case someone do have my issue:

Traceback (most recent call last):
  File "run.py", line 2, in <module>
    from app import app
  File "G:\Tommy\Programming\Websites\Python_Websites\flaskHW\app\__init__.py", line 1, in <module>
    from flask import Flask
  File "C:\Program Files\Python36\lib\site-packages\flask\__init__.py", line 19, in <module>
    from jinja2 import Markup, escape
  File "C:\Program Files\Python36\lib\site-packages\jinja2\__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "C:\Program Files\Python36\lib\site-packages\jinja2\environment.py", line 15, in <module>
    from jinja2 import nodes
  File "C:\Program Files\Python36\lib\site-packages\jinja2\nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "C:\Program Files\Python36\lib\site-packages\jinja2\utils.py", line 647, in <module>
    from markupsafe import Markup, escape, soft_unicode
  File "C:\Program Files\Python36\lib\site-packages\markupsafe\__init__.py", line 14, in <module>
    from markupsafe._compat import text_type, string_types, int_types, \
ModuleNotFoundError: No module named 'markupsafe._compat'

@alorence's solution fixed it all. Kudos to him for fixing an hours long issue.

@gKevinK
Copy link

gKevinK commented Dec 30, 2017

Here is a simple solution. Since it is a decode error, it can be solved by changing the console's coding to utf-8. Just run

chcp 65001
pip install markupsafe

and it works.

@OlegBrony
Copy link

no. it's didn't help.

(myvenv) d:\work\Python\2018\hook\app>main.py
Traceback (most recent call last):
  File "D:\work\Python\2018\hook\app\main.py", line 1, in <module>
    from flask import Flask
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\flask\__init__.py", line 19, in <module>
    from jinja2 import Markup, escape
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\jinja2\__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\jinja2\environment.py", line 15, in <module>
    from jinja2 import nodes
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\jinja2\nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\jinja2\utils.py", line 647, in <module>
    from markupsafe import Markup, escape, soft_unicode
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\markupsafe\__init__.py", line 14, in <module>
    from markupsafe._compat import text_type, string_types, int_types, \
ModuleNotFoundError: No module named 'markupsafe._compat'

(myvenv) d:\work\Python\2018\hook\app>chcp 65001
Active code page: 65001

(myvenv) d:\work\Python\2018\hook\app>pip install markupsafe
Requirement already satisfied: markupsafe in d:\work\python\2018\hook\myvenv\lib\site-packages

(myvenv) d:\work\Python\2018\hook\app>main.py
Traceback (most recent call last):
  File "D:\work\Python\2018\hook\app\main.py", line 1, in <module>
    from flask import Flask
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\flask\__init__.py", line 19, in <module>
    from jinja2 import Markup, escape
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\jinja2\__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\jinja2\environment.py", line 15, in <module>
    from jinja2 import nodes
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\jinja2\nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\jinja2\utils.py", line 647, in <module>
    from markupsafe import Markup, escape, soft_unicode
  File "d:\work\Python\2018\hook\myvenv\lib\site-packages\markupsafe\__init__.py", line 14, in <module>
    from markupsafe._compat import text_type, string_types, int_types, \
ModuleNotFoundError: No module named 'markupsafe._compat'

did I do something wrong?

@OlegBrony
Copy link

before this I had tried install flask:

(myvenv) d:\work\Python\2018\hook\app>pip install flask
Collecting flask
  Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 287kB/s
Collecting Werkzeug>=0.7 (from flask)
  Downloading Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
    100% |████████████████████████████████| 327kB 613kB/s
Collecting itsdangerous>=0.21 (from flask)
  Downloading itsdangerous-0.24.tar.gz (46kB)
    100% |████████████████████████████████| 51kB 1.7MB/s
Collecting click>=2.0 (from flask)
  Downloading click-6.7-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 1.8MB/s
Collecting Jinja2>=2.4 (from flask)
  Downloading Jinja2-2.10-py2.py3-none-any.whl (126kB)
    100% |████████████████████████████████| 133kB 1.2MB/s
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->flask)
  Downloading MarkupSafe-1.0.tar.gz
Installing collected packages: Werkzeug, itsdangerous, click, MarkupSafe, Jinja2, flask
  Running setup.py install for itsdangerous ... done
  Running setup.py install for MarkupSafe ... error
Exception:
Traceback (most recent call last):
  File "d:\work\python\2018\hook\myvenv\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd1 in position 3: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\work\python\2018\hook\myvenv\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "d:\work\python\2018\hook\myvenv\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "d:\work\python\2018\hook\myvenv\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "d:\work\python\2018\hook\myvenv\lib\site-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,
  File "d:\work\python\2018\hook\myvenv\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "d:\work\python\2018\hook\myvenv\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd1 in position 3: invalid continuation byte

(myvenv) d:\work\Python\2018\hook\app>pip install flask
Collecting flask
  Using cached Flask-0.12.2-py2.py3-none-any.whl
Collecting Jinja2>=2.4 (from flask)
  Using cached Jinja2-2.10-py2.py3-none-any.whl
Requirement already satisfied: itsdangerous>=0.21 in d:\work\python\2018\hook\myvenv\lib\site-packages (from flask)
Requirement already satisfied: click>=2.0 in d:\work\python\2018\hook\myvenv\lib\site-packages (from flask)
Requirement already satisfied: Werkzeug>=0.7 in d:\work\python\2018\hook\myvenv\lib\site-packages (from flask)
Requirement already satisfied: MarkupSafe>=0.23 in d:\work\python\2018\hook\myvenv\lib\site-packages (from Jinja2>=2.4->flask)
Installing collected packages: Jinja2, flask
Successfully installed Jinja2-2.10 flask-0.12.2

and code of programm:

from flask import Flask
app = Flask(__name__)
if __name__ == '__main__':
    app.run()

@gKevinK
Copy link

gKevinK commented Feb 22, 2018

@OlegBrony It seems that Markupsafe is failed to build and install, but pip thinks it is already installed after the unsuccessful install. Maybe this issue only appears in Virtualenv environment. Please try to uninstall, 'chcp 65001', and install it again.

@umaim
Copy link

umaim commented Mar 16, 2018

@gKevinK Yep, reinstall worked. Thank you a lot.

Guts added a commit to isogeo/isogeo-api-py-minsdk that referenced this issue Mar 27, 2018
storing raw wheels in repo to workaround pallets/markupsafe#67
@ArmoGidec
Copy link

I used "git bash" for reinstalation markupsafe and it helped me. No one UnicodeDecodeError

@maxiplux
Copy link

Hi , Today I have the same problem on win10 , please dont't try to solved it .
Download the best whl for your python version .
https://www.lfd.uci.edu/~gohlke/pythonlibs/#markupsafe
pip install MarkupSafe-1.0-cp36-cp36m-win_amd64.whl

thanks for this amazing project

@maxtortime
Copy link

maxtortime commented May 3, 2018

I also saw this error. But I upgraded my pip to 10.0.1 and resolved problem.
My pip verson is pip 10.0.1 from python 3.6
I'm using WIndows 10 now.

@elcantador
Copy link

@maxtortime solution solved it for me

@davidism
Copy link
Member

Closing, it looks like upgraded pip solved it, but it will also be solved by #45.

@davidism
Copy link
Member

davidism commented Nov 5, 2018

PyPI has wheels for MarkupSafe 1.1.0.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests