I am migrating my Plugin to QGIS 3.0. Currently a bit stuck trying to install PyPDF2. I have been trying different things for the last couple of hours or more, without success.

I have got another version of Python installed (3.5, which I use for other things and 2.7...partly - I uninstalled it via Windows today although the folder is still there at C:\Python27. Probably I have to manually delete the remainder) Anyway I believe it should be quite possible to run more than one version. I have done it before.

QGIS uses Python 3.6, here: C:\Program Files\QGIS 3.0\apps\Python36

So in the standard scenario I would install PyPDF2 from OSGeo4W Shell. I run OSGeo4W Shell and type o-help which shows a list of available modules including pip3 (although not pip). I presume I should use pip3 to install PyPDF2. So I type this command:

pip3 install PyPDF2

I get the familiar message 'Fatal error in launcher: Unable to create process using '"''

I have trawled the forums for solutions to this but the ones I have tried have not worked for me. It sounds as if this should be fixed by upgrading pip, from what I understand(?)

If I run pip3 install --upgrade pip3 it doesn't work either. Same error, as might be expected

I have tried to run pip / pip3 from a command window opened from the path C:\Program Files\QGIS 3.0\apps\Python36\Scripts

If I do ./pip3 install PyPDF2 from a Powershell window there I get the same error again.

If I go up one level to the Python36 folder and run python -m pip3 install PyPDF2 I get the error No module named pip3

And so and so forth.

In an effort to make sure I am using the correct (QGIS) version of Python I added the '\QGIS 3.0\apps\Python36' folder to the PYTHON_HOME variable and added %PYTHON_HOME% to the Path variable.

How can I install PyPDF2??


Although I still don't understand how to properly resolve the problems I had installing PyPDF2 for QGIS 3.0 / Python 3.6, I have found a workaround. I referred to the PyPDF2 documentation and saw that it is described as a pure Python library without any external dependencies. Since I had it installed for my 'main' (non-QGIS) Python version, which is 3.5, I guessed that I could simply copy it across.

I copied the folder PyPDF2 from



C:\Program Files\QGIS 3.0\apps\Python36\Lib\site-packages

It works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.