Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Nov 20, 2023 7:39 pm

from spire.pdf import *
ModuleNotFoundError: No module named 'spire.pdf'; 'spire' is not a package

pip installs correctly on linux as well as windows.

farhanthakur
 
Posts: 3
Joined: Mon Nov 20, 2023 5:48 pm

Tue Nov 21, 2023 5:38 am

Hello,

Thank you for your inquiry.
Based on the information provided, I have not been able to replicate the issue you mentioned during testing. Please confirm whether the installation of Spire.Pdf through PIP (pip install Spire.Pdf) was successful. Additionally, kindly check your Python directory's Lib folder to ensure the presence of the 'spire' and 'pdf' folders as depicted in the screenshot.
screenshot.png


Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Tue Nov 21, 2023 6:14 am

spire.pdf.png
Yes the pip installation was successful and the directory is as described.
This happens on windows as well as linux.
the __init__.py in the spire folder always shows 0 kb as the file size though even after reinstallation.

farhanthakur
 
Posts: 3
Joined: Mon Nov 20, 2023 5:48 pm

Tue Nov 21, 2023 8:57 am

Hello,

Thank you for providing the information.
After conducting an investigation, I have found that the cause of the program error is the filename of your Python file, "spire.py." I have logged the issue into our bug tracking system with the ticket number SPIREPDF-6403. Our development team will investigate and fix it. Once it is resolved, I will inform you in time. Sorry for the inconvenience caused.
Additionally, during my testing, I discovered that changing the Python file name to something else, such as "Test.py" resolved the issue. Therefore, I recommend that you first modify the Python file name and then test it again.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Tue Nov 21, 2023 3:51 pm

yes it works if I rename the file.
In fact if spire is even included as a part of the filename it gives this error, like spireExtract.py

farhanthakur
 
Posts: 3
Joined: Mon Nov 20, 2023 5:48 pm

Wed Nov 22, 2023 1:55 am

Hello,

Thank you for your feedback.
I'm glad to hear that the issue has been resolved.
Regarding the problem you mentioned with the Python project named "spireExtract.py," I conducted some initial testing, but I was unable to reproduce the issue you described. The execution results are as follows:
result.png


Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Mon Jun 22, 2026 12:27 pm

This issue persists for me using Spire.PDF 12.6.2 on Python 3.11.6 running on Fedora Linux.
I installed Spire.PDF successfully using the command
pip install spire-pdf
.
However when I run a Python script containing code such as
from spire.pdf import *
I get an error message
ModuleNotFoundError: No module named 'spire'
.
I have tried downloading and installing the .whl file directly and also installing an earlier version of Spire.PDF - the outcome is the same each time.
I can't find any file named spire.py - was that a project file created by the original poster rather than part of the package/module installation?

AndrewWas
 
Posts: 2
Joined: Mon Jun 22, 2026 7:33 am

Tue Jun 23, 2026 2:06 am

Hello,

Thank you for reaching out.

Could you please confirm if the GLIBC version in your Fedora Linux system is 2.34 or higher? If your system does not support glibc 2.34 or above, we recommend deploying via a container.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3047
Joined: Wed Jun 27, 2012 8:50 am

Tue Jun 23, 2026 7:48 am

Thanks for the swift response! However the mistake was mine: I am using PyCharm, which uses packages installed in a virtual environment, rather than system-wide installed ones. My test script works fine with spire.PDF whn run from the command line.

Please close this issue, or preferably delete it - unless it may be of use to others, though Spire is incidental to the root cause.

AndrewWas
 
Posts: 2
Joined: Mon Jun 22, 2026 7:33 am

Tue Jun 23, 2026 10:16 am

Hello,

Thank you for your prompt and detailed response. I appreciate you taking the time to clarify the situation.

Please don’t hesitate to reach out if you encounter any further questions or need assistance. We are always here to help.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3047
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF

cron