I word with windows 10, python 3.7. (i am also a linux user and to be honest i don't try this with fedora should i try ?)
I use the lastest version of pyinstaller.
When i execute the .exe "ModuleNotFoundError: No module named 'Crypto'"
I double check, Crypto is installed.
(I don't need comment like : don't use crypto because it is not safe)
So, since yesterday, l search online.
At the begining, i didn',t know for the hidden import. So i add it to the in the .spec.
But the error still come up.
Then i try to add the hidden import in command and obviously same error.
I read some other post, and i don't really understand the hook.py stuff. In the github projectof pyinstaller, i find a hook folder. And i don't have it on my computer. Should i have them ?
But soemthing weird came up, i have a file in dist\prepare\libcrypto-1_1.dll
And if this file is really about crypto why the .exe don't use it ?
I try with --onefile and --onefolder doesn't change anything.
if you need something, let me know, i will edit the post.
Thank you for your help, and sorry if the question may sound like stupid.
And sorry for my english ^^
I find the reason, i am a noob
I make a copy of my python direcotry in C:/ and pyinstaller don't find it.^^(because i need it for my IDE)
My bad ^^
Related
So, I was working on one of my projects when I decided that I would make it a command-line-based tool. I could not find any reliable information (maybe I just searched for the wrong thing, sorry if this is a duplicate, I am new to packaging). I have seen many other projects do it so that all they need to do is:
pip install packageName
packageName -args
I tried doing this, I added arguments, so that works, but I am not sure how to do this. I have tried looking for solutions, and I have only come across some topics on stackoverflow that only talk about dealing with file permissions using chmod commands, etc. I am just confused.
So at this point, I was expecting my file to be executable, or make it in an easy way / have a way to do it through python packaging, but I still am not sure how. I just want my package to be installed with pip, and then easily executed without having to use "python3" and ".py" and having to CD into the project directory every time of use.
I tried searching the internet but no information has come across to me yet.
I am sorry for duplicates. I have looked at other solutions but they all use chmod and I just want to package it in a python package through PyPi.
Please, if you can help, it would be great.
Thanks in advance.
After a couple of hours, I was able to solve the problem.
Here is the full explanation:
https://setuptools.pypa.io/en/latest/userguide/entry_point.html
This helped so much. All I needed to do was to put:
[project.scripts]
projectName = "pathtofunction"
I solved all the issues regarding importing by putting all of the code in the init.py file.
Hope this helps to anyone who had any trouble.
I was trying to add the Strings library into the Robot Framework Interpreter folder in PyCharm, where first it showed me error
Command errored out with exit status: 1
So, I googled out this issue first, and this link suggested me to delete 'strings.py' file from the libraries. I did so and now nothing is working.
Anything I do now, it shows error of "ModuleNotFoundError: No module named 'string'".
I could not even install string using
pip install strings
command.
Whatever I try to do with pip, now shows this error.
Can anyone please suggest me the solution for this?
I am using Python version 3.10.
Several notes:
The library in question is 9 years old, is not maintained, is known by the author to be buggy, was written as a joke, and does not contain anything useful. There is no good reason why you should be trying to install it for your project. If you think you need it for something, then you have some other misconception that needs to be cleared up.
The link you found did not tell you to delete strings.py from "the libraries". It said something about deleting string.py - notice, no s at the end - from a local project folder. The reason for this is because that name conflicts with the library name. The page author's own source file, named string.py, sought to import the standard library file string.py (as it clearly says import string in the screen shot), but it cannot - because it finds itself first. This is a common problem for new Python users.
DO NOT EVER MANUALLY EDIT THE CONTENTS OF YOUR INSTALLATION DIRECTORY ON THE ADVICE OF SOME RANDOM WEB PAGE.
Ideally, don't ever do it at all. That content is not intended to be touched. Installers exist for a reason. If for some incredibly specific reason you feel the need to do this, make sure you have backups of everything and that you are 100% sure you can restore everything to its initial state if anything goes wrong.
The person writing that web page was incorrect. The installation error had nothing to do with the string.py file.
The actual cause of the problem is that the package is broken and cannot be installed properly on anyone else's machine. Again, this is no big loss as there is no use for the package anyway.
The reason it is broken is that the setup script for the package tries to import the code that's being installed, in order to get version and author information. This seems to work locally, but fails for everyone else.
To reiterate: the person writing that article wrote nonsense. (I'm not surprised; the page formatting is awful and the grammar isn't particularly great either.) Looking further, it appears that the entire website is authored by the one person, who is clearly just trying to self-promote (with a Youtube channel as well) while lacking the necessary expertise. Browsing around the rest of the site a bit, I see articles that are pedantic and not very insightful, and occasionally inaccurate - but all very SEO optimized.
I recommend ignoring that website entirely.
To reiterate: the string module comes with your Python. You cannot reinstall it with pip - not with the strings package you found, nor any other package. Your options are:
Find the correct string.py contents (possibly from a backup, assuming you thought to make a backup before deleting something from an installation directory) and restore them. This is the official repository for the reference implementation of Python. You might be able to find it in there somewhere. I don't recommend trying. There is a lot to go through and it is possible to damage things further.
Reinstall Python completely.
The error that you are getting is because you deleted the string.py file. There is no string module to be imported from PyPi. This is why pip install string doesn't work. Restore the deleted file as it is not the cause of your problem.
If you try to install Strings library it will fail because you are using Python 3.10 and the Strings library that you want to import and install is quite old and not supported for this Python version. Therefore you get the ModuleNotFoundError: No module named 'strings' that you see in the link that you attached.
For the setup.py file from the library I see that it recommends using Python 3.3, so I will recommend you to use that version of Python if you want to use this specific library.
Please note that the link that you provided is probably in case that you have created your own string.py file.
I solved this question by deleting any __pycache__ folder in the project directory.
First of all, I am new to both Python as well as the world of VSCode (recently moved over from Atom). I will also say that I am using an Early 2014 MacBook Air running macOS Catalina. I really do love VSCode! It's amazing in many ways, but this... this is just too unclear.
Okay, I have tried literally almost everything and I don't understand why my imports won't work! I have looked at the documentation on the issue on Github (I will say I may have something with the directory wrong there, referring to the docs). I have tried the "python.autoComplete.extraPaths": [], thing. I have tried changing my (virtual) environment and, of course, setting up a new one myself. I have tried setting "python.languageServer:" to Jedi and back to Microsoft. I can't even find the "python.jediEnabled: false" comment that everybody is telling me to uncomment.
Yet, my imports are still "unresolved (Microsoft language server)" or "not found (Terminal)" or "unable to be imported (Pylint)". It just makes me so angry and I don't understand what I've done wrong!
I've seen modules like pygame and requests work just fine on VSCode for many others (YouTube), yet mine has yet to work.
Can someone please tell me the secret that I don't apparently know? Thanks.
Update Post: My Virtual Environment is using my System Python rather than my Venv's Python
Thank you for everyone who has helped (so far). I am getting a lot closer to solving this. ^-^
They had removed "python.jediEnabled" setting instead of "python.languageServer", you can refer to here.
Maybe you haven't installed the package which you want to import, because you had used the wrong 'pip'. When you select the right environment, you need to activate it(Ctrl+Shift+`), otherwise, you'd use the wrong 'pip'. You can type 'pip --version' to check which 'pip' you are using. Then you can try to install the package you want to import.
This question already has answers here:
a good python to exe compiler? [closed]
(3 answers)
Closed 9 years ago.
With some useful answers of my previous question (See below), I decided to give py2exe another try.
I tried the tutorial from py2exe.org (http://www.py2exe.org/index.cgi/Tutorial), but got an error at step 3. I did 1 and 2 exactly as told, and put both files (hello.py and setup.py) in my main folder where I installed python in: D:\Programs\Python.
When running the 'code' form step 3 I got the following error, totally on the bottom of the output:
"ImportError: DLL load failed: %1 is not a valid Win32-application.*"
I've got a screenshot of the entire output, but I don't know where to upload it.
Extra information:
I have 64bit Windows 7 (profesional) and Python 2.7.3 (first I had 3.3.0, but downgraded because of some reasons). It is not a big problem for me to change to another version. I downloaded py2exe 0.6.9.
Note: I couldn't choose between py2exe for 32- or 64bit. I guess then a error should show up earlier, but it might be handy to know.
*I literally translated the last part from Dutch, so it can be slightly different then English pc's.
Previous question:
What is the easiest .py to .exe converter?
I've tried a few converters, of which cx_Freeze and py2exe. Using cx_Freeze was too complicated (I couldn't find a good tutorial) and py2exe gave some errors. Before I'm going to try to understand one of these two or try another one, I want some input which converter you think is the best, and I need a good tutorial.
I have barely experience with cmd, and am quite a newbie if it comes to programming/python, so I am looking for the easiest-to-use converter.
If you say I really need some cmd experience, please direct me to a cmd tutorial/course.
you can use GUI2exe that's the easiest way im my opinion !
You wont learn much about the converter's but it gets the job done without any problems.
ps. GUI2exe isnt a converter , its a gui to use the converters!
What kind of erros does py2exe give you? That is what I use and it works like a charm for me.
I've used py2exe previously. I assume you've looked at the tutorial on the py2exe project page?
There is also a good one available on the Python Library page.
I used py2exe for complicated Python/Qt/PyQt applications. The biggest thing you'll need to know about that is that the MSVCP90.dll file is needed. You can get that from Microsoft. You'll then need to copy it and the other files mentioned in it's license to the Python DLLs directory. Detailed instructions are available on the py2exe tutorial (Step 5)
Try py2exe and cx-freeze. These are the two most common ones you'll find out there. Most others are generally a derivative of cx-freeze
So, I've got a program I made in python 2.6, it ran fine as normal python, and ran fine when made into an exe via py2exe v0.6.9. I used signtool to sign it, having changed nothing else, and it stops working.
When I run the signed exe, I receive an "ImportError: No module named os" from line 1 of my script. I did some digging and found this: http://osdir.com/ml/python.py2exe/2008-04/msg00031.html, which seems to be a very close description of my problem. I manually applied the patch linked to from the py2exe website to my build_exe.py file, though I was running py2exe 0.6.9 instead of 0.6.6, so I tried to take that into account. Still no love.
According to the link, this seems to be a py2exe issue. I don't know though. Any help would be much appreciated. And of course, I'll answer any other questions I can that you have about this. Thanks for the help!
If it's a py2exe issue, maybe give the newer PyInstaller a shot to build your executable. It's in active development, unlike py2exe which apparently hasn't been updated since 2008-11-16.