![]()
This has to do with working within a jupyter notebook trying to call a function in a local module in another directory which has both different general and particular aspects. #How to import a module folder in python jupyter notebook codeI share this directory between machines and relative imports allow me to use the same code everywhere, & I often use notebooks for quick prototyping, so suggestions that involve hacking together absolute paths are unlikely to be helpful.Įdit: This is unlike Relative imports in Python 3, which talks about relative imports in Python 3 in general and – in particular – running a script from within a package directory. If the solution to the problem requires treating it as a module and including an _init_.py file (even a blank one) that is fine, but doing so is not enough to solve the problem. Note, also, that at least as originally intended project1 wasn't thought of as a module and therefore does not have an _init_.py file, it was just meant as a file-system directory. ![]() Note, the notebook server is instantiated at the level of the meta_project directory, so it should have access to the information in those files. Is there any way to get this to work using relative imports? SystemError: Parent module '' not loaded, cannot perform relative import I get the following error: SystemError Traceback (most recent call last) When working in notebook.jpynb if I try to use a relative import to access a function function() in module.py with: from. Reply to this email directly, view it on GitHub, or unsubscribe.I have a directory structure similar to the following meta_project You are receiving this because you commented. #How to import a module folder in python jupyter notebook installIf its a more recent version, then there might be an issue with the underlying torch installation - I don't know.Īlso note that pip install syft reverts both tornado (back to 4.5.3) and notebook (back to 5.7.8) installations - so beware! If older than 0.2.1.a1 then the import should be from. Please check your version of syft in each environment. Locate the kernel.json file (using jupyter kernelspec list) of the kernel you're launching and ensure the python used in the argv stanza is the same as the python used from the command line. On Monday, July 27, 2020, 03:56:32 PM GMT+1, Kevin Bates wrote:Īs noted multiple times above, given things work in python directly and not from a kernel launched from the notebook server, this is most likely a difference in envs between the two python executables. I am a novice to python and Jupiter notebook as well. #How to import a module folder in python jupyter notebook how toHello Kelvin,Many thanks, I don really know how to play around, I wish I could get direct command line to execute to clear the error. Or, if you know what your doing, use sudo to install with administrator permission. prefix='/Users/bussonniermatthias/anaconda'. sys-prefix Install to Python's sys.prefix. Needed to install into a non-default location, such as prefix PREFIX Specify an install prefix for the kernelspec. profile PROFILE Specify an IPython profile to load. ![]() Helpful when you have multiple IPython kernels. Specify the display name for the kernelspec. Have multiple IPython kernels at the same time. name NAME Specify a name for the kernelspec. user Install for the current user instead of system-wide h, -help show this help message and exit $ /path/to/python -m ipykernel install -help
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |