I'm using Python 3.6.5 and I've built my application in py file -it works fine-, and I can run it on cmd perfectly. So I want to built its exe file.
I tried with cx_freeze, py2exe but they didn't work for me.
Lastly I tried with PyInstaller, it looks successfully completed; but when I'm running my exe file, I have this error and I tried many ways to solve this but I didn't. The error is in this picture
ImportError: Failed to import the Cloud Storage library for Python. Make sure to install the "google-cloud-storage" module.
I'm so sure that I've installed google-cloud-storage and requests packages (I checked many times with pip install google-cloud-storage and pip install google-resumable-media[requests] and it says Requirements already installed
What I've tried are;
-adding google folders from site-packages folder to dist folder
-installing grpio (already installed)
-changing google hooks files' inside
But I didn't find any solution.
What should I do to solve this problem?
Related
For some odd reason no matter which package I install when I go to import it doesn't know what package I'm talking about. I am very certain this is a Visual Studio Code error but if not I am also using Linux.
When I pip install the package pyttsx3 this is what I get in the Terminal:
Collecting pyttsx3
Downloading https://files.pythonhosted.org/packages/24/4e/580726c73272344d3e74b7aaffae55ff6b6450061fbecb8cc6e112531c02/pyttsx3-2.7.tar.gz
Building wheels for collected packages: pyttsx3
Running setup.py bdist_wheel for pyttsx3 ... done
Stored in directory: /home/secretlloyd/.cache/pip/wheels/a2/8a/fe/11112aca9c89142c3a404bc67ef3393a7ad530da26639a05d4
Successfully built pyttsx3
Installing collected packages: pyttsx3
Successfully installed pyttsx3-2.7
But when I run a example I get this error:
Traceback (most recent call last):
File "/home/secretlloyd/Visual Studio Code/Python/Finished/Text Colors/finished.py", line 1, in <module>
import pyttsx3
ModuleNotFoundError: No module named 'pyttsx3'
You can use an virtual environment to install your libs. If you do that, each project will have its own scoped libs without affect your global libs.
How to use the virtual environment?
Enter the root folder of your project and then run the following commands on the bash:
$ py -m venv .env
$ source .env/Scripts/activate
After that you'll notice your bash will have a prefix like that (.env). Then you should install your libs:
(.env) $ pip install pyttsx3
In order to deactivate the virtual environment just run the following command:
(.env) $ deactivate
Setup VS Code Intellisense for Virtual Environment
If you're using VSCode you can set the correct python interpreter after setting up a virtual environment. Just follow the steps:
Open VSCode in your project
Press F1
Type: > python: select interpreter
Click on Enter path or find an existing interpreter
Click on Find
The navigate to .env > Scripts > python
3 possible cases:
The same thing happened to me when I did not notice I was using two Pythons at the same time one 2.7 and another one 3.6. Make sure to know where is your package being installed to the Python modules folder you really want to store it or in another one you did not know existed.
Your PATH might not be configured correctly, check out either if you are using Windows or Linux if your PATH variables are configured correctly. You can reset your configuration if you wish. (link= How to reload .bashrc settings without logging out and back in again?)
For some packages/libraries of Python the way of importing the library is different from the name you import it on your .py file. For example: You can install OpenCV library by [pip install OpenCV] but when importing it in a file you have to write [import cv2].
I hope you find this information helpful for your problem.
I have created a conda environment and activated it already.
Then inside the use_cases/ directory I execute: pip install -e use_case_b (https://github.com/geoHeil/dagster-demo/tree/master/use_cases):
...
...
Installing collected packages: use-case-b
Attempting uninstall: use-case-b
Found existing installation: use-case-b 0.0.0
Uninstalling use-case-b-0.0.0:
Successfully uninstalled use-case-b-0.0.0
Running setup.py develop for use-case-b
Successfully installed use-case-b
Now when inside the use_cases/ directory:
python
import use_case_b
works fine.
When switching to a different directory like: / (= the root of the repository I get an error message of:
ModuleNotFoundError: No module named 'use_case_b'
Why is it working once and failing in the second place? Could it be that it is not even working in the first place and only importing the sub_directory due to the __init__.py file?
How can I get the python package properly install into the virtual environment?
FYI: here you can find the full project https://github.com/geoHeil/dagster-demo
When using the cookiecutter to set up the package it works just fine.
https://github.com/audreyfeldroy/cookiecutter-pypackage
This is more like a workaround than an solution to the SF question - but works nicely and as an additional benefit has some best practices with regards to documentation and testing already built in.
I normally face that problem when im using pip to install a package. Im not sure if this gonna work for you.
In the file you are importing the package copy the following code and run it.
from pip._internal import main
main(["install", "use_case_b"])
Just ignore the warnings'
Good Luck, Let me know if it works.
I'm running python code which uses the dlib module. I'm using arch linux, so I downloaded dlib from here: https://aur.archlinux.org/packages/dlib/
Then I try to import the dlib module, but it still doesn't work:
ModuleNotFoundError: No module named 'dlib'
Is there a dependency that I didn't download or am I downloading the wrong module? I can't figure out what the problem is, since I downloaded the official module already.
I fixed the problem, all you have to do is to search in your package manager if you are a linux user, and try importing dlib in your python code, if that didn't work, then download dlib from this link: https://sourceforge.net/projects/dclib/files/latest/download
extract the files, and run the setup.py files, it will take a while till it finishes, and that should make it work, you can now run codes using dlib library with no problems.
hope that helps someone :D.
I had a same issue, but you need to download it to your site-packpages of where your python is there for python-idle or if ur getting a download error in pycharm , I solved the error by downloading dlib from cmd to the venv of my pycharm.project directory command being install dlib--19.16.0 (current one) or you can download a .whl file which suits your python,processor configuration run dt .whl file and your good to go
I am trying to export a GeoTiff with Blender using the Blender Python API (based on Python 3), so I've decided to install GDAL on Ubuntu (14.04). What I would like is to get the module as a standalone folder that I could put in the modules directory of Blender (/home/user/.config/blender/2.73/scripts/modules).
The thing is I've run through several different problems trying to install GDAL. I've tried to install from source (for GDAL 2.0.0) here : Official PyPi Gdal
I ran sudo apt-get install libgdal-dev gdal-bin (I list it here because it may be important)
When I am in the extracted GDAL folder, using python setup.py build & python setup.py install, the library installs to /usr/local/lib/python2.7/dist-packages/osgeo. However, when I run python from command line, running from osgeo import osr returns ImportError: No module named _gdal
Following GDAL via pip , I used pip (pip install GDAL) to install the library, and the folder it went to was /usr/lib/python3/dist-packages/osgeo (using pip show ...). Again, running python3 and trying to import results in the same error. Of course, when I copy-paste each folder in the blender module directory, I get the same error in the Blender Python console.
So I decided to compile the sources using ./configure --with-python & make & make install in the source folder. I then copied the folder GDAL-x.x.x/build/lib.linux-x86_64-3.4/osgeo to the blender modules directory and got this time the error when importing : ImportError: /home/yvesu/.config/blender/2.73/scripts/modules/osgeo/_gdal.so: undefined symbol: _Py_ZeroStruct.
Trying to compile with python3 using python3 setup.py build returns the error error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
EDIT 1:
I think I've found the solution : I went to the directory swig/python (not found in a GDAL-1.11.0 folder but gdal-1.11.0 fodler, can't remember where I downloaded it from), ran python3 setup.py build & python3 setup.py install and could finally find the folder in /usr/local/lib/python3.4/dist-packages/GDAL-1.11.0-py3.4-linux-x86_64.egg/osgeo. When I put this osgeo folder oni the Blender modules directory, I was able to import osgeo in Blender. I will report if anything went wrong.
I think I've listed all my attempts at installing GDAL on Ubuntu. Can anyone point me in the right direction? Do you think it is even possible to install it as a standalone module, or do I need linked libraries through LD_LIBRARY_PATH?
Here is the solution I've found :
Download Gdal sources (v2.0.0 is the current stable release) from ftp://ftp.remotesensing.org/gdal/2.0.0/ or http://download.osgeo.org/gdal/2.0.0/ and untar
Go to the directory gdal2.0.0/swig/python
Run python3 setup.py build & python3 setup.py install
Finally find the module folder in, on Ubuntu : /usr/local/lib/python3.4/dist-packages/GDAL-2.0.0-py3.4-linux-x86_64.egg/osgeo
I can now use it in Blender (copying in the modules directory)
I cannot figure out how to install hdf5-1.8.9-linux-x86_64-shared so that I can install h5py-2.0.1
I have extracted the "tar-balls" but cant find the setup.py file to run.
Has anyone else done this recently?
I'm running the shell through SSH, and I dont have root access so I need to install in my home folder.
I think you might have downloaded a binary.
For source installation :
http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/release_docs/INSTALL
Then for the python wrapper :
http://h5py.alfven.org/docs/intro/build.html