I am using ray library of python but I got an error even if I have the mentioned file.
The error is the following:
FileNotFoundError: Could not find module 'C:\Users\boezi\PycharmProjects\AWSDeepRacerChallenge\env\lib\site-packages\ray_raylet.pyd' (or one of its dependencies). Try using the full path with constructor syntax.
pip did not recognize the library, therefore I downloaded the wheel archive, I extracted it and I put the content in the site-packages folder of my virtual environment.
The package is recognized and I can use automatic filliing with my IDE but I have the aforementioned problem.
Related
I just install PyFoam using:
pip install PyFoam
Then I wrote a test.py file using:
import PyFoam
Now I got an error message:
import PyFoam
ImportError: No module named PyFoam
Then I tried install again, and I got this:
pip install PyFoam
Requirement already satisfied: PyFoam in ./.local/lib/python3.8/site-packages (2021.6)
Requirement already satisfied: numpy in ./.local/lib/python3.8/site-packages (from PyFoam) (1.23.0)
Could anyone help? Tks.
The issue is likely that you use one version of pip and another version of the Python interpreter. This is particularly common if you have several Python installations on your system. Check that these versions match with each other.
For example, run
python --version
pip --verion
You should see output similar to the following:
Python 3.10.2
pip 22.1.2 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)
Notice the matching version numbers. I am verifying this on my system with Homebrew, under MacOS, but I assume that it's similar on other systems. Here, different instances of "python" and "pip" binaries are suffixed with the version number. So, if your version of "pip" says "3.8", try specifying "python3.8" as interpreter.
It might also be helpful for troubleshooting to know of the "-m" switch, in order to locate a module. In your example, you would run:
python -mPyFoam
Notice the capitalization for this module, which can differ between the one being used to install the module through pip and when importing it. On my system, as an example, it outputs:
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3: No module named PyFoam.__main__; 'PyFoam' is a package and cannot be directly executed
The error message is fine. It does still mean the module was found. That is in contrast to an output like the following:
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3: No module named pyfoam
The -m switch is documented under https://peps.python.org/pep-0338/.
Another possibility might be that you need to check and configure your Python module search path, as described here https://docs.python.org/3/tutorial/modules.html.
When a module named spam is imported, the interpreter first searches
for a built-in module with that name. These module names are listed in
sys.builtin_module_names. If not found, it then searches for a file
named spam.py in a list of directories given by the variable sys.path.
sys.path is initialized from these locations:
The directory containing the input script (or the current directory
when no file is specified).
PYTHONPATH (a list of directory names, with the same syntax as the
shell variable PATH).
The installation-dependent default (by convention including a
site-packages directory, handled by the site module).
Note On file systems which support symlinks, the directory containing
the input script is calculated after the symlink is followed. In other
words the directory containing the symlink is not added to the module
search path. After initialization, Python programs can modify
sys.path. The directory containing the script being run is placed at
the beginning of the search path, ahead of the standard library path.
This means that scripts in that directory will be loaded instead of
modules of the same name in the library directory. This is an error
unless the replacement is intended. See section Standard Modules for
more information.
It's possible to try to think of other causes. But without any additional information about your setup it would probably be too speculative and become confusing for other people reading this answer, so I will leave it at these two causes, which I believe to be the most common for this type of issue.
I'm trying to embed a C++ application with Python. I downloaded the minimum zip file from python.org for embedding, installed pip and installed numpy. But when executing a simple test with PyRun_SimpleString("import numpy"); it returns an error ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'.
I tried to install other libs with pip and tried to import them, they all work, except numpy. I have the paths to my python36, Lib and DLLs folder. Upon debbugging with ProcessMonitor I see _multiarray_umath.cp36-win_amd64.pyd in the numpy/core folder is never used when I run it with my C++ application.
If I use the normal command line python.exe import numpy approach with the same python folders it works and _multiarray_umath.cp36-win_amd64.pyd is used.
I tried adding the site-packages path or even the full numpy path, but still it doesn't use the .pyd file like the command line python.exe. I tried adding libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll and python36.dll to the numpy/core folder as suggested by other posts, but it didn't have any impact.
What else can be the problem?
Thank you very much in advance.
I am having a lot of issues when uploading a PyPi package, because I have a package that reads information from a TXT file in another directory. This is my project structure:
I can read the files if I do it using my own package from the PyCharm project, but the problem is when I upload it to PyPi and I import is as a pip package.
I read the file in local this way:
tickers = pd.read_csv('../data/tickers.csv')
But that does not work when I install the package using pip.
I have been trying to configure setup.py, but with no succeed, because when I install the package uploaded to PyPi using pip, I get an error like this:
FileNotFoundError: [Errno 2] No such file or directory:
'data/user-agent-list.txt'
This is what I have in my setup.py related to those external files contained in the data/ directory:
I also have a MANIFEST.in to include the data files:
I hope the information I provided is enough for you to let me know how can I fix this... To give you extra information, I am following this tutorial to upload my package to PyPi, but the error has nothing to do with it.
Thank you!
I am wondering if the issue is not related to the path you are using here:
pd.read_csv('../data/tickers.csv')
It refers to the path that is relative to the base execution path of the script that is using your module. Try using a non-relative path. You may also want to use the install path as suggested in this question.
I am using python 2.7.13 and
I am facing problems importing ruamel.yaml when I install it in a custom directory.
**ImportError: No module named ruamel.yaml**
The command used is as follows:
pip install --target=Z:\XYZ\globalpacks ruamel.yaml
I have added this custom directory to PYTHONPATH env variable
and also have a .pth file in this location with the following lines
Z:\XYZ\globalpacks\anotherApp
Z:\XYZ\globalpacks\ruamel
There is another app installed similarly with the above settings
and it works.
What am I missing here?
PS: It works when I install in site-packages folder
also it worked in the custom folder when I created an init.py file
in the ruamel folder.
EDIT:
Since our content creation software uses python 2.7 we are restricted to
using the same.We have chosen to install the same version of python on all
machines and set import paths to to point to modules/apps locacted on shared
network drive.
Like mentioned it works in pythons site-packages but not on the network drive
which is on the PYTHONPATH env-variable.
The ruamel.yaml-**.nspkg.pth and ruamel.ordereddict-*-nspkg.pth are
dutifully installed.Sorry for not giving complete details earlier.Your inputs
are much appreciated.
I am a relative newbie with Python and was trying to install wxPython 2.9 using Python 2.6. I did a build from source and then installed the package both being done in a non-standard (local) path. When I try and import wx (having provided the path to the installation folder in my environment variable), I get the following error message:
"ImportError:
libwx_gtk2u_xrc-2.9.so.1: cannot open
shared object file: No such file or
directory".
Can someone please tell me if I need to build gtk separately? And if yes, how do I go about doing it?
Add the directory containing the library given in the error to your ld search paths. See the ldconfig(8) man page for details.