Unable to import MNIST dataset using MLDatasets package in Julia - import

I am trying to get the MNIST dataset in Julia using the MLDatasets package via the following commands in a .jl file:
using MLDatasets
dataset_train = MNIST(:train)
dataset_test = MNIST(:test)
This is what's indicated in the MLDatasets documentation. However, I am getting the following error:
ERROR: MethodError: objects of type Module are not callable
Stacktrace:
[1] top-level scope
# c:\my\julia\file\...
For some reason Julia is interpreting MNIST to be a module. It is worth noticing that this exact same code works without problem in a friend's computer, who has the same operating system, and the same Julia version (OS: Windows, x86_64-w64-mingw32; Julia version: 1.8.2).
The MLDatasets package is installed and does import correctly with the using command. What may be the problem?

The most likely reason is that you have an older version of MLDatasets installed on your computer. The current version is 0.7.5, while you probably have a 0.5.x version installed. This can happen if there are package conflicts that prevent the latest version of MLDatasets from being installed.
If you're using the default v1.8 environment to install all packages, conflicts like this are more likely to happen. It's recommended to instead create a separate environment for your project, and install only the packages you need for that particular project in that environment.
Older versions of MLDatasets had MNIST as a sub-module rather than as a type, which is the reason for this particular error message.
You can compare your environment's status (] status) and the one in your friend's setup. ] status --outdated can also help you see which particular package is causing the issue here. But I would suggest just keeping your base Julia environment (v1.8) minimal, uninstalling packages except the ones that you need to be available everywhere (eg. IJulia). See also the "Creating your own projects" section of the Pkg documentation.

Related

pyodbc has a .pyi file but mypy doesn't see the stub file

pyodbc has a .pyi file but when running pytest-mypy, I have this error:
__________________________________________________________________________________________________ connexion.py __________________________________________________________________________________________________
3: error: Cannot find implementation or library stub for module named "pyodbc"
3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
_
This should only happen when the library doesn't have stub files but it appears there are stub files. What should I do?
I'm using Python 3.10.2 and i've updated pyodbc to the latest version (pyodbc==4.0.34)
Let's assume your python is installed in /usr. In that case, your python executable will be in /usr/bin, and any libraries you install with pip will be installed in /usr/lib/python3.10/site-packages. In this case, all the sources for pyodbc can be found in /usr/lib/python3.10/site-packages/pyodbc.
Following this pattern we would expect to find type stubs in /usr/lib/python3.10/site-packages/pyodbc.pyi, but there is an issue in pyodbc, so that the stubs are actually installed in /usr/pyodbc.pyi.
In order to pick up this path, you will need to modify settings in your development environment. In Linux, try setting PYTHONPATH=/usr in your environment. The link mentioned in rogdham's comment includes others' comments on how to make this work in VS Code. Other development environments should support similar workarounds.

omp_set_nested routine deprecated, please use omp_set_max_active_levels instead

I started getting the following warning repeatedly when running my PyTorch Lightning deep learning scripts, at execution start and then all through the training:
"OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead."
I get them when executing the main.py script; my scripts are publicly available here.
Symptoms:
I don't think it has anything to do with PyTorch Lightning, maybe even PyTorch.
It appeared overnight, so I don't know what could cause it.
It runs fine without those warnings on my PC.
I get the warnings when I run from my M1 Mac.
I use VSCode for both, each up to date.
I use separate miniconda environments.
Thanks for taking the time to reply!
I managed to sort myself out in the end.
I spotted the numba package in my miniconda env, which is a Python compiler and that seemed to be the root of the problem.
It was version 0.55.2 but the last version to date is 0.56.0. Trying to upgrade it via conda or pip didn't work for some reason (the 0.55.2 version couldn't be replaced).
I recreated my env step by step, and noticed this package comes with torch-audiomentations, a package for audio data augmentation for deep learning, under torch, that I use.
Re-installing it had numba version 0.56.0 installed properly, and the warnings disappeared.
That routine is deprecated, meaning that newer standards want you to use another routine. If you can not edit the code, just ignore. For now it's only an info message. You got that message when you switched to a newer OS / compiler version / OpenMP version.

Making VS Code Remote extension work with GLIBC 2.17 installed in non standard locations

I'm trying to use VSCode Remote extension to connect to a remote host that runs on RHEL/CentOS 6, but it fails to connect since CentOS 6 ships with GLIBC 2.12 and GLIBCXX 3.4.1. As mentioned in this post, in order to get the extension to work, the workaround is to install GLIBC>=2.17 and GLIBCXX>=3.4.18.
Unfortunately, I don't have sudo access for the server, so I won't be able to update these libraries using the bash script provided in the link. Also, in this SO post, the author says not to update the system GLIBC since it can break down system applications. That being said, I've tried something different -- I extracted those rpm packages, as described in this blog, inside my home folder. I've then updated the env variables PATH and LD_LIBRARY_PATH in ~/.bash_profile to point to these new locations. But the node binary (in VS Code Remote) still can't find these libraries.
Is there a way to let the node binary know where to look for these libraries? More precisely, can someone explain how I can make this extension work without sudo access?
I've got it to work by installing gcc and glibc using Linuxbrew. See this post for more details: https://github.com/microsoft/vscode-remote-release/issues/103#issuecomment-546551293.
Couple of things to take note of:
Node binary versions in VS Code Server may vary between commits. In the GitHub comment above, the author uses node#10 -- you may replace it with node#12; everything would still work.
Make sure glibc and gcc are properly installed using linuxbrew. This step is key.

How to install multiple versions of a compatible package in CentOS with YUM

Is there a way to install multiple versions of the same package in CentOS/RHEL (7/8) if the package installs separate files in each version?
We have an application we've recently converted to using RPM instead of a home-built package manager based on tar. In order to make atomic-like switches between versions, each version installed in separate directories with the version number in the name, and a symlink with the unversioned name pointed to the current, or previous, version at any given moment in time. The application, of course, used the unversioned name to get init script, configuration files, interpreter version and code. I'm thinking that the alternatives package would be the basis for this, although we wouldn't use the alternatives command to manage symlinks (although there's no technical reason not to).
Not exactly as you describe.
Some packages allow this (Kernel and Kernel-devel being two of them) but i beilieve this is an exception added within the package manager.
Certain Applications like PHP and Python which is perfectly acceptable to have multiple version (Python2.X and 3.X) do this by changing the base name of the application/rpm.
Take a look at: https://rpm.org/user_doc/multiple_versions.html
It gives a good insight on how to achieve what you want

How to check previous installed version number of SciPy using Anaconda?

I wrote some code months ago testing different optimizations of a function. I've since updated my anaconda installations of scipy, numpy, etc. that the code uses. Now the functions have different speeds (some faster, some slower), despite using the same code.
Is there anyway to check what the previous version of scipy that was installed was so I can attempt to see if something in scipy changed affecting my code? I use anaconda for package management, so I'm not sure if there's some record of previously installed versions somewhere. In particular I'd like to check cKDTree and cdist to see if either has changed in any meaningful way since my last installed version.