I am trying to run the example found in the README of the PyLSCI package. It references a module util, so I am trying to install that through Conda, but it is not working. I have tried typing conda install util into the Anaconda Prompt, but I get an error that says:
PackagesNotFoundError: The following packages are not available from current channels
How can I install this module?
Additional Details
Windows OS
Anaconda Python distribution
There is no such "util" package. Seems like a classic grad-ware pattern: an old example is shown in the README.md referencing a local util.py file, that is kept in the release even though it is no longer relevant. Please file an issue on the GitHub repository to ask the author to update the documentation.
The mentioned util.py package is only used for the demo.ipynb, and it is exemplarly for any custom logic that is required to convert your speckle data to NumPy arrays, which is out of scope of PyLSCI.
See this GitHub issue for details, where I clearified this with Briget
The PyLSCI package itself doesn't rely on the mentioned util.py to work properly, as long as you provide the speckle data as NumPy arrays.
To make that more evident, I renamed the module to my_utils.py, and moved it with the demo.ipynb notebook to the binder directory of the repo, also see the latest release notes for further changes.
Related
I have an ImportError issue with my AWS Lambda function
I can run this code locally without ImportError
I use zappa serverless for uploading my code to AWS Lambda--which requires a virtual environment and is an end-to-end solution for creating and updating Lambda functions
I previously had this code working on AWS Lambda
I'm not sure of the change I made (#3) that made this code go from working to ImportError. The log output is as follows.
[ERROR] Runtime.ImportModuleError: Unable to import module 'dailycore': Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "/var/lang/bin/python3.8"
* The NumPy version is: "1.23.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
I'm unclear if this is a Numpy issue, a Python issue, or a Zappa issue. Two changes I made that may have had an impact:
I separated out some of my personal code, uploaded it to github, and installed it as packages within the virtual environment using pip
I uninstalled Python from my machine and reinstalled it--as I had two versions causing conflict. Upon my reinstallation (Python 3.8), I changed the installation directory from its default.
The code runs from VS Code locally and wholly contained from within the virtual environment (i.e. I don't have any packages installed via pip on my machine outside of virtual environments at this point). The suggestions above may or may apply to this error. I've tried adding a system PATH variable to my Python 3.8 directory. I've tried downgrading numpy to 1.23.0. I've tried uninstalling all dependencies within the virtual environment and reinstalling them.
UPDATE: I found this link and am looking into these comments: https://github.com/Miserlou/Zappa/issues/1222
UPDATE2: I deleted the virtual environment and re-created per a suggestion at the link above. This did not work.
UPDATE3: I think my issue relates to the private package dependencies I installed via pip from my personal github repos (#2-2). This link may be related. Something about dependencies not being at the top level. I am unsure how to fix this issue and/or repackage my private repo or install correctly. Any clarification is appreciated.
UPDATE4: I've isolated my issue to the private package dependencies and how they get called. A the solution may be related to Lambda Layers, tutorial here. Looking into this.
The ImportModuleError is related to this python package: alpha_vantage and not either of my initial theories. I am unsure as to why, though. It seems like it has something to do with Alpha Vantage's setup.py file; although I could be mistaken.
I have removed the reference to Alpha Vantage for now, but if anyone knows why installing this package would throw a numpy error, please elaborate. I think the only reference to numpy would be through the pandas package--which is only an optional install (i.e. extras_requires in setup.py)
I'm a beginner in Python and I have no experience with GitHub at all. I want to import the module semsimlib from the following URL: https://github.com/timvdc/semsimlib
I have looked on the internet for help on how to do this but most of it is very unclear and doesn't seem to work for me. Can anyone provide a detailed explanation on how to do this in a easy way?
It looks the repo does not provide appropriate scripts to simply install the package. There is no setup.py file and there is no distribution on pypi.
What you can do is go to site-packages folder inside your python installation or inside your virtual environment. Then run git clone https://github.com/timvdc/semsimlib. You should now be able to import semsimlib. Keep in mind that you will also have to install all the other dependencies your self one by one since there is also no requirements file.
You can also clone the repo into any folder on your computer and at the top of your script put:
import sys
sys.path.append("path/to/semsimlib/folder")
semsimlib will now be importable. However, I would try to get it to work with the first method.
The Problem
I am working on a project that uses a package in beta with multiple versions (package name: psychxr). After some confusing error messages about missing modules, I have discovered that depending on where I source my installation from I get different package contents.
If I use pip to install psychxr, I get an ovr sub-package. However, if I install from source (via official github repository), I get a libovr sub-package. Is there a way I can rename the source package such that I can get both modules? Alternatively, is there a better way to go about this? Although the packages complete roughly the same task, their implementations are noticeably different, and I'd like access to both.
CMD output of >>>python -c help('psychxr')
Version 1 (OVR)
NAME
psychxr
PACKAGE CONTENTS
ovr (package)
VERSION
0.1.4
Version 2 (LIBOVR)
NAME
psychxr
PACKAGE CONTENTS
libovr (package)
VERSION
0.2.0
Post Script: I do apologize for any misuse of terminology, or illegibility. I'm fairly new to both python and cmd in windows.
I found this package of descent gradient optimization variants in python.
I installed python interpreter but i don't know how i can run the package.
I already tried to use windows cmd.
Ididn't used python before ,thanks a lot for helping me.
py-optim github
The github repository lacks a setup.py. If you want to install it, add the following code with the name setup.py to the top-level folder of the repository on your device. Then add one __init__.py file to the folder ..\PyOptim. The __init__.py can be totally empty. Try also to file an issue in the repo, stating that the setup.pyis missing.
from setuptools import setup
setup(name='pyoptim',
version='0.1',
description='optimizerTool',
url='https://github.com/schaul/py-optim',
author='None',
packages=['PyOptim',
'PyOptim.algorithms',
'PyOptim.benchmarks',
'PyOptim.core',
'PyOptim.external_libs'])
Afterwards, open a cmd in the top-level folder, and run
python setup.py install
This installs everything. You then can import everything.
Note: This is only a quick- setup.py. Please also add install-requeries and so on to install dependencies of the repo.
If you want the folders test and tools also to be installed, add an empty __init__.pyfile to these folders as well and add the names in the packages list in the setup.py.
EDIT: Use this fork of the repository were i added the missing files. Make sure you install python 2.x as this repo is not for 3.x.
I'm running a code on deep learning, which uses the opencv module, by running python main.py (contains import cv2 statement), but always get the error 'ImportError: dynamic module does not define module export function (PyInit_cv2)'.
I've tried to reinstall my anaconda and create new virtual environments, but all got the same result. This problem really confuses me a lot and I've googled for many related problems, none of them works. I think the problem is something related to the environment and has nothing to do with the code, because I got the same result by simply run import cv2 in python prompt. The more confusing thing is that, even after I remove the opencv module, I also get the same problem, but not a ModuleNotFoundError. Does anyone can give me some advice? Thanks a lot!
I think I found one possible reason of this error.
Recently I was configuring the caffe environment on one server, I downloaded the source code of opencv-2.4.13 and compiled manually, added /usr/local/opencv-2.4.13/build/lib to $PYTHONPATH, and caffe worked well. After that, when I entered one of my virtual environment using conda activate py35, which uses python3.5, tried import cv2 in the python prompt, got the error above.
I'm not sure but I think the cause of the error is opencv-2.4.13 compiles a python2 interface so it can't be imported by python3. Python imports packages by searching the directories listed in sys.path, where $PYTHONPATH is in the second place after the current working directory (This is a great article introduces the mechanism of python finding packages). So when we enter the py35 environment, python will first look for $PYTHONPATH and find the opencv installed on the root directory instead of finding the opencv in the virtual environment using conda install opencv-python.
So there are two solutions of this problem:
Use python2 instead.
Remove /usr/local/opencv-2.4.13/build/lib from $PYTHONPATH.
which all work for me.
Similar post, might help:
ImportError: dynamic module does not define init function (initfizzbuzz)
Could you provide info on how you installed the CV module?
I had the same problem, which was caused by the cv2.so file in /usr/local/lib/python2.7/site-packages/cv2.so. After I deleted the file and use command sudo pip3 install opencv-python, it worked for python3.