Nupic Installation on MacOS(12.0) error

Hello Everyone,

I am trying to install nupic on Mac. I am using jupyter lab to install the nupic. I am running python2 kernel on Jupyter lab and using pip 19.2.3 to install nupic by (!pip install nupic).

I am getting the error :
‘Operating System :: Microsoft :: Windows’,
RuntimeError: support for python < 3.6 has been removed in setuptools_scm>=6.0.0

I have also attached an image regarding the issue. I do not have any idea regarding the issue. Please let me know the possible solution.

Hi, any reason not to use HTM Core instead? It’s actively developed and runs on python3 . Unlike nupic & python2 which are in “maintenance mode” meaning no further development.

1 Like

I want to learn how the encoder works in HTM. That’s why I try nupic. I did not knew that we had an option. As in the nupic docs, I saw that we need python2 to run nupic.
Thank you for your reply Cezar, I think I will be trying to work with HTM Core. If I have any problems I will reach out.
Regards

1 Like

I’d start with the HTM School videos on encoders if you haven’t already. Matt explains everything really well with lots of visuals.

@sheiser1 Thank you for the link. Sure I will watch the videos. Regards.

1 Like

I guess I’ll pickup the thread here. I’m trying to install htm.core on OSX 12.3 using conda. Close enough, right?
Steps:

conda create --name htm.core python=3.7
conda activate htm.core
conda install packaging cmake

As far as I can tell, this should be good to go, so I run python setup.py install --user --force in the directory where I have cloned the htm.core repository. During the setup I get a large number of these warnings:

CMake Deprecation Warning at CMakeLists.txt:4 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

then this (only once):

CMake Warning (dev) at /opt/anaconda3/envs/htm.core/share/cmake-3.22/Modules/CMakeDependentOption.cmake:84 (message):
  Policy CMP0127 is not set: cmake_dependent_option() supports full Condition
  Syntax.  Run "cmake --help-policy CMP0127" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
  build/ThirdParty/pybind11/pybind11-src/CMakeLists.txt:98 (cmake_dependent_option)
This warning is for project developers.  Use -Wno-dev to suppress it.

and then this a number of times for different reasons:

In file included from /htm.core/src/htm/encoders/SimHashDocumentEncoder.cpp:30:
/htm.core/build/ThirdParty/digestpp/digestpp-src/hasher.hpp:136:10: error: variable 'len' set but not used [-Werror,-Wunused-but-set-variable]
                size_t len = 0;

Finally, it ends with this:

2 errors generated.
make[2]: *** [src/CMakeFiles/LibrarySource.dir/htm/encoders/SimHashDocumentEncoder.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
1 error generated.
make[2]: *** [src/CMakeFiles/LibrarySource.dir/htm/algorithms/TemporalMemory.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/LibrarySource.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
  File "setup.py", line 414, in <module>
    getExtensionFiles(platform, build_type)
  File "setup.py", line 241, in getExtensionFiles
    generateExtensions(platform, build_type)
  File "setup.py", line 305, in generateExtensions
    subprocess.check_call(["cmake", "--build", ".", "--target", "install", "--config", build_type, "--", "-j", "4"]) 
  File "/opt/anaconda3/envs/htm.core/lib/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '4']' returned non-zero exit status 2.

When I run cmake --version from a bash prompt I see this:

cmake version 3.22.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

I would appreciate any help getting htm.core installed, thanks!

1 Like

Hey @TheFinn, you could try these steps which worked for me:

From command line:

  • Clone htm.core repo : git clone https://github.com/htm-community/htm.core.git
  • CD to htm.core dir : cd htm.core
  • Create fresh env : conda create -n htm_env python=3.9.7
  • Switch to fresh env : conda activate htm_env
  • Install packages : pip install -r requirements.txt
  • Run setup.py : python setup.py install
1 Like

Thanks @sheiser1, but your method ends similarly to mine on the last command ( python setup.py install). Here is the output after what looks like a happy line:

[  4%] Building CXX object src/CMakeFiles/LibrarySource.dir/htm/algorithms/TemporalMemory.cpp.o
In file included from /htm.core/src/htm/algorithms/TemporalMemory.cpp:44:
/htm.core/src/htm/utils/GroupBy.hpp:95:71: error: 'result_of<(lambda at /htm.core/src/htm/algorithms/TemporalMemory.cpp:296:25) (const unsigned int &)>' is deprecated [-Werror,-Wdeprecated-declarations]
          typename KeyType = typename std::remove_const<typename std::result_of<
                                                                      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/type_traits:4009:34: note: 'result_of<(lambda at /htm.core/src/htm/algorithms/TemporalMemory.cpp:296:25) (const unsigned int &)>' has been explicitly marked deprecated here
template <class _Callable> class _LIBCPP_DEPRECATED_IN_CXX17 result_of;
                                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__config:1066:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
#  define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
                                      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__config:1043:48: note: expanded from macro '_LIBCPP_DEPRECATED'
#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
                                               ^
[  4%] Building CXX object src/CMakeFiles/LibrarySource.dir/htm/encoders/DateEncoder.cpp.o
[  5%] Building CXX object src/CMakeFiles/LibrarySource.dir/htm/encoders/ScalarEncoder.cpp.o
1 error generated.
make[2]: *** [src/CMakeFiles/LibrarySource.dir/htm/algorithms/TemporalMemory.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src/CMakeFiles/LibrarySource.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
  File "/htm.core/setup.py", line 414, in <module>
    getExtensionFiles(platform, build_type)
  File "/htm.core/setup.py", line 241, in getExtensionFiles
    generateExtensions(platform, build_type)
  File "/htm.core/setup.py", line 305, in generateExtensions
    subprocess.check_call(["cmake", "--build", ".", "--target", "install", "--config", build_type, "--", "-j", "4"]) 
  File "/opt/anaconda3/envs/htm.core/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '4']' returned non-zero exit status 2.

It looks like there is a problem with TemporalMemory.cpp.o.

Hello.
I am trying to install the last step.I am getting the error:FileNotFoundError: [WinError 2] 系统找不到指定的文件。
Can you help me with the solution?
Thank you very much.

Hi @Lsh, welcome!
To help resolve this, would you show all your steps that led to the error? Like what you did from start to finish, including the terminal command led to the error. Thanks

Hi
Thanks,@sheiser1.I met a error when I run python setup.py install.

Hi,

The file that is not being found is:
“C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe”

Do you have MS Visual Studio installed?
Is Visual Studio it installed at this location?
I notice you have some different drive letters “C” and “G”, is visual studio installed on your “C” drive?

HTH

Hi @dmac, thanks for replying for me. Just got back from traveling so was going to look into this today.
If Visual Studio is installed, vswhere.exe would be stored at that location on the C: dirive. This program will tell the script which version is installed so the script can set the build parameters to match.

@Lsh, Visual Studio Community edition is free from microsoft. https://visualstudio.microsoft.com/downloads/. htm.core should work with Visual Studio 2022 which is the latest.

1 Like

@TheFinn I will check the versions on the htm.core dependencies. We should be able to build on MacOS v12.0 but maybe we need a newer version of something.

I will echo this sentiment as well.

The instructions should specifically be able to tell a Mac OS user the commands to run.
If I follow what the readme.md says for “simple python build (any platform)” it doesn’t work on Mac OS 12.3.1


It says to run the following:

python setup.py install --user --force

And that fails
bradleyfrank@bradleys-air htm.core % python setup.py install --user --force

zsh: command not found: python


If I try to use python3 instead of python:
bradleyfrank@bradleys-air htm.core % python3 setup.py install --user --force

/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools’ objects directly or at least import Setuptools first.
warnings.warn(
Traceback (most recent call last):
File “setup.py”, line 34, in
from packaging import version
ModuleNotFoundError: No module named ‘packaging’


It would be helpful to get the steps listed with the explicit set of steps needed to make it work.

Hi
Thanks,@dmac @sheiser1 .I have installed Visual Studio 2022.I met a new error when I run python setup.py install.

Hi,
You need to install the following python packages first: pip install setuptools packaging

bradleyfrank@bradleys-air htm.core % pip install setuptools packaging
zsh: command not found: pip

Apparently need to use pip3:

bradleyfrank@bradleys-air htm.core % pip3 install setuptools packaging
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: setuptools in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages (49.2.1)
Collecting packaging
Downloading packaging-21.3-py3-none-any.whl (40 kB)
|████████████████████████████████| 40 kB 9.1 MB/s
Collecting pyparsing!=3.0.5,>=2.0.2
Downloading pyparsing-3.0.7-py3-none-any.whl (98 kB)
|████████████████████████████████| 98 kB 7.3 MB/s
Installing collected packages: pyparsing, packaging
Successfully installed packaging-21.3 pyparsing-3.0.7

Now it complains about not having cmake:
bradleyfrank@bradleys-air htm.core % python3 setup.py install --user --force
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools’ objects directly or at least import Setuptools first.
warnings.warn(
Python version: 3.8.9 (default, Feb 18 2022, 07:45:33)
[Clang 13.1.6 (clang-1316.0.21.2)]

Traceback (most recent call last):
File “setup.py”, line 414, in
getExtensionFiles(platform, build_type)
File “setup.py”, line 241, in getExtensionFiles
generateExtensions(platform, build_type)
File “setup.py”, line 301, in generateExtensions
configure(platform, build_type)
File “setup.py”, line 339, in configure
cmake_ver = getCMakeVersion();
File “setup.py”, line 271, in getCMakeVersion
result = subprocess.run([“cmake”, “–version”], capture_output=True, text=True)
File “/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py”, line 493, in run
with Popen(*popenargs, **kwargs) as process:
File “/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py”, line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py”, line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: ‘cmake’
bradleyfrank@bradleys-air htm.core % cmake
zsh: command not found: cmake