Closed NickHallPhysics closed 4 years ago
Try downloading and installing the Microsoft Visual C++ Redistributable for Visual Studio 2019 from Microsoft's website https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
Depends on where you got your libfreetype from. For mingw compiled libfreetype, you need libgcc_s*.dll occasionally.
The OP said he downloaded the package from PyPI using pip so he should have got the wheel with the embedded DLL built using Visual Studio
Try downloading and installing the Microsoft Visual C++ Redistributable for Visual Studio 2019 from Microsoft's website https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
This fixed the issue. Cheers.
I get the same error on Windows 10 with pip 20.0.2 and Python 3.8. It does work if I try to install freetype-py==2.1.0
instead of 2.2.0. It tries to build from the source zip instead of getting the prebuilt wheel. What could be wrong?
That might be a different issue. @madig?
The OP said he downloaded the package from PyPI using pip so he should have got the wheel with the embedded DLL built using Visual Studio
But didn't. Which is also what I am seeing.
It turns out my Python 3.8 was a 32 bit version: I upgraded to a 64 bit version and all is fine now.
Happy to have helped you upgrade to 64 bits!
I'm seeing this same issue with 64-bit python/anaconda:
C:\Users\synbio>conda info
active environment : base
active env location : C:\Users\synbio\anaconda3
shell level : 1
user config file : C:\Users\synbio\.condarc
populated config files :
conda version : 4.9.0
conda-build version : 3.18.11
python version : 3.8.3.final.0
virtual packages : __cuda=9.1=0
__win=0=0
__archspec=1=x86_64
base environment : C:\Users\synbio\anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\synbio\anaconda3\pkgs
C:\Users\synbio\.conda\pkgs
C:\Users\synbio\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\synbio\anaconda3\envs
C:\Users\synbio\.conda\envs
C:\Users\synbio\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.9.0 requests/2.24.0 CPython/3.8.3 Windows/10 Windows/10.0.16299
administrator : False
netrc file : None
offline mode : False
(base) C:\Users\synbio>conda activate freetype_test
(freetype_test) C:\Users\synbio>conda list
# packages in environment at C:\Users\synbio\anaconda3\envs\freetype_test:
#
# Name Version Build Channel
ca-certificates 2020.10.14 0
certifi 2020.6.20 py38_0
openssl 1.1.1h he774522_0
pip 20.2.4 py38_0
python 3.8.5 h5fd99cc_1
setuptools 50.3.0 py38h9490d1a_1
sqlite 3.33.0 h2a8f88b_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_3
wheel 0.35.1 py_0
wincertstore 0.2 py38_0
zlib 1.2.11 h62dcd97_4
(freetype_test) C:\Users\synbio>conda list
# packages in environment at C:\Users\synbio\anaconda3\envs\freetype_test:
#
# Name Version Build Channel
ca-certificates 2020.10.14 0
certifi 2020.6.20 py38_0
freetype-py 2.2.0 pypi_0 pypi
openssl 1.1.1h he774522_0
pip 20.2.4 py38_0
python 3.8.5 h5fd99cc_1
setuptools 50.3.0 py38h9490d1a_1
sqlite 3.33.0 h2a8f88b_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_3
wheel 0.35.1 py_0
wincertstore 0.2 py38_0
zlib 1.2.11 h62dcd97_4
(freetype_test) C:\Users\synbio>pip install --no-cache-dir freetype-py
Collecting freetype-py
Downloading freetype_py-2.2.0-py3-none-win_amd64.whl (708 kB)
|████████████████████████████████| 708 kB 6.4 MB/s
Installing collected packages: freetype-py
Successfully installed freetype-py-2.2.0
(freetype_test) C:\Users\synbio>python
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import freetype
Traceback (most recent call last):
File "C:\Users\synbio\anaconda3\envs\freetype_test\lib\site-packages\freetype\raw.py", line 49, in <module>
_lib = ctypes.CDLL(filename)
File "C:\Users\synbio\anaconda3\envs\freetype_test\lib\ctypes\__init__.py", line 381, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\synbio\anaconda3\envs\freetype_test\lib\site-packages\freetype\libfreetype.dll' (or one of its dependencies). Try using the full path with constructor syntax.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\synbio\anaconda3\envs\freetype_test\lib\site-packages\freetype\__init__.py", line 24, in <module>
from freetype.raw import *
File "C:\Users\synbio\anaconda3\envs\freetype_test\lib\site-packages\freetype\raw.py", line 52, in <module>
raise RuntimeError('Freetype library not found')
RuntimeError: Freetype library not found
>>>
what does work is cloning the repo, pip install .
or python setup.py
and then copying the 64bit prebuilt binary from here into my environment directory :yikes:.
Maybe the conda build is out of sync. I'm not even sure who made the conda package.
@rougier the freetype
installation above is with pip
, so I don't think conda is to blame. My only guess right now is that there's something else in Windows on these machines that is blocking the install.
Sorry, read too fast and just stopped at the conda commands. Maybe the best is to open a new issue with a full description.
I have installed freetype using the recommended pip install freetype-pi. However, when attempting to import it, I get the following error: