Issue importing Google Neuroglancer Package - python

I am using Google's Neuroglancer which I downloaded from GitHub and trying to run an example script provided by them. However, one of the lines is import neuroglancer, and since I cloned the whole repo there is a neuroglancer folder with all of the required files, but I am getting the following error:
ImportError: No module named 'neuroglancer'
Is there any way I could fix this? I don't see the issue since neuroglancer is in the same file path as the python script.

In case you are running the example in the neuroglancer project try following their guide.
Otherwise you might want to try and installing the Neuroglancer package using something like pip and a virtual environment to be able to import the package into the project.

Related

Import python module from a GitHub repo that does not have setup.py

I want to import OpenBulletToPython library from GitHub So how do I do that? When I tried using pip install git+https://github.com/Categorically/OpenBulletToPython, I receive an ERROR: File "setup.py" not found for legacy project git+https://github.com/Categorically/OpenBulletToPython. So how can I import it??
Unfortunately the repository you linked to does not have a setup script.
So, you basically have to options:
Copy & Paste the code into the project where you want to use it (check the license before you do this)
Fork the repository and add a setup script yourself (as described here)

AWS Lambda -- Unable to import srsly.ujson.ujson for SpaCy

I am trying to add SpaCy as a dependency to my Python Lambda. I am doing this by installing SpaCy as a standalone dependency inside a directory named dependencies using pip3 install spacy --no-deps -t . This is because I can't load the entire Spacy dependency inside the \tmp directory of my Lambda.
I am able to successfully upload the folder to s3 and download it during the Lambda invocation. When I try to import spacy, I get this error: [ERROR] Runtime.ImportModuleError: Unable to import module : No module named 'srsly.ujson.ujson'.
I manually installed srsly inside dependencies\ and I have all the files that are listed as per this link. This was referenced by this link. One of the responses says, "it seems like Python can't load it, because it's not compiled?". How would I compile a dependency which has a .c file in it?
One other question which I found on SO is this question, but I have already manually installed srsly. How to I import the module? Thanks.
I manually check in my code for the presence of ujson before importing spacy like this:
if os.path.exists('/tmp/dependencies/srsly/ujson/ujson.c'):
print('ujson exists')
and the print statement gets printed.
For me pip uninstalling and installing srsly again worked fine.. sometimes its just the compatibility issue with your python version so make sure correct python/srsly versions are present
Well it is a bit strange, but my solution for this problem was to create an aditional "ujson" folder in the srsly folder and then move all the ujson generated code to the folder "ujson" previously created

Module robot.api not found when importing in python code

I have a Python/Selenium project where I need to run code from a different file than the main one with from ABC import XYZ, but in the same driver (without opening a new window). From what I found, it seems that the idea is to make a singleton file, which I've done using the code from their website.
Initially, I've been getting "lib not found", which was fixed with pip install robot, but now I'm running into "No module named 'robot.api'" and I can't seem to find the issue. Tried pip install robotframework-databaselibrary but that wasn't it.
What am I missing here? FYI, my singleton.py is in the same folder as the other two .py files and my first line "from robot.api import logger" is greyed out in PyCharm.
You have installed the wrong package - robot looks like a Django library, while you need robotframework:
pip install robotframework
But before installing the correct one, remove the robot package - you'll have two with the same name, and the "wrong" probably resolves first.

Pip - No module named vimpdb

I'm trying to install the vimpdb lib but it's working, even though I successfully installed vimpdb using pip install I always get this error:
import vimpdb; vimpdb.set_trace();
ImportError: No module named vimpdb
I'm running the code locally but when I run the same code as a simple script (without using localhost) it imports correctly, it only throws an error when I start a server and begin to try using this plugin.
Any ideas?
Thansk!
App Engine won't import Python modules on your Python path. You need to actually include the module within the App Engine project.
For example, in the same directory as app.yaml, you could add a symbolic link similar to this:
vimpdb -> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vimpdb
Or you could copy the vimpdb directory to that location.

python "ImportError: No module named xyz" on shared hosting

Similar questions have been asked on SO, I tried to follow their solution but so far no success.
I have downloaded gspread from here to use it in my project.
Locally in mac + eclipse + pydev everything works fine.
When I copy the code to my shared hosting environment (centos, bluehost) I get the error no module named gspread:
Traceback (most recent call last):
File "ReadSpreadsheet.py", line 8, in
import gspread
ImportError: No module named gspread
Here is my directory structure:
src/
gspread/
__init__.py
SpreadsheetReader/
__init__.py
ReadSpreadsheet.py (calls import gspread)
Python version is 2.7 both locally and on shared hosting env. On shared I installed python 2.7 myself in ~/python.
I am not sure when it works locally in pydev why it doesn't work in the shared hosting environment.
Since I only develop locally and just use git pull on the sever to copy the code my preferred solution is not to have a custom code for the server. Setting env variables, etc is not perfect but acceptable.
Sorry in advance if the question looks similar. I was struggling for the past day with no luck. I think this should be a fairly common importing situation.
Thanks to the comments, installing pip and then installing gspread using pip solved the problem.
pip install gspread
The command above is mentioned in the gspread documentation.

Categories