how to install node.js in linux server using putty - linux

-bash-3.2$ ./configure --prefix=$HOME
File "./configure", line 287
o['default_configuration'] = 'Debug' if options.debug else 'Release'
SyntaxError: invalid syntax.
How do I fix this error?

The error you're receiving is the result of using an older version of Python. To build Node.js, you must use version 2.6 or 2.7 of Python.
To fix your problem, update Python to a supported version. Also make sure that your PATH variable points to the correct Python you want to use, as installing a package might not change where the variable points to.
To check your version of Python, use this command:
python -V

do not enter -bash-3.2$ at the beginning. Just do
./configure --prefix=$HOME File "./configure", line 287
o['default_configuration'] = 'Debug' if options.debug else 'Release'

Related

Python (PyCharm) - Protoc is not a recognized command

I realize there are other threads already, but none of the solutions are working for me. This is my error when trying to use the protoc command: Protoc.
I'm using Windows10 and a virtual environment in PyCharm using python 3.8 and pip is updated using the console command.
I installed protobuf with pip and then I've manually downloaded protoc following the installation guide on https://grpc.io/docs/protoc-installation/.
I have tried both adding the path to the protoc.exe file in my venv path variables and copying it to Tensorflow/models/research, but neither yields a positive result.
I've tried both protoc-21.1-win64.zip and protobuf-python-4.21.1.zip. I added the path to the protoc.exe folder when using the win64 version but I'm not sure which folder contains the file for the python version, although I see most people recommend to use the windows version anyways.
Through my PyCharm terminal in my C:\Users\Name\PycharmProjects\Project_Name I'm attempting to run
protoc object_detection/protos/*.proto --python_out=.
I have tried to run it from C:\Users\Name\PycharmProjects\Project_Name\venv as well if that should make a difference.
These are the most prominent threads I've attempted solutions from:
Cannot find `protoc` command
protoc object_detection/protos/*.proto: No such file or directory
Make sure you add the Protoc compiler to the path instead of adding it in PyCharm as that usually brings problems.

Building NSIS from source on windows (VS2012)

I'm working on a pure x64 version of my software. Our installer for the x86 version is NSIS and my software is built using VS2012. I found online that in order to build x64 installers using NSIS you have to build NSIS (and all plugins/etc) from source. That is the end goal. However, right now I'm having issues just building x86 (before moving on to x64) using the instructions in the NSIS docs. https://nsis.sourceforge.io/Docs/AppendixG.html#build_windows
I'm trying to build NSIS v3.0.4 which uses SCons to build. I've installed scons using pip (SCons version 3.1.1).
However, when trying to build NSIS, I get the following (using python 3.8.0).
C:\Source\nsis\nsis-code-r7069-NSIS-tags-v304>scons ZLIB_W32=C:\Source\zlib-1.2.7 MSTOOLKIT=yes
scons: Reading SConscript files ...
TypeError: cannot use a string pattern on a bytes-like object:
File "C:\Source\nsis\nsis-code-r7069-NSIS-tags-v304\SConstruct", line 263:
for v in re.compile(r'^\\H\{[v]?(\S+)\}', re.M).finditer(File('#/Docs/src/history.but').get_contents()): # Try to parse the Halibut history file
the section of the SConstruct file is as follows (starting at line 260 so the for loop starts at 263):
if not defenv.has_key('VER_PACKED'):
import re
found = None
for v in re.compile(r'^\\H\{[v]?(\S+)\}', re.M).finditer(File('#/Docs/src/history.but').get_contents()): # Try to parse the Halibut history file
if v and not found:
v = v.group(1).split('.')
if len(v) >= 2:
mi = int(re.search(r'\d+', v[1]).group())
if mi < 1: mi = 1 # Make sure we can subtract 1 from the minor number so trunk stays below the next release
defenv['VER_PACKED'] = '0x%0.2i%0.3i%0.2i%0.1i' % (int(re.search(r'\d+', v[0]).group()), mi - 1, 66, 6)
if int(defenv['VER_PACKED'], 0) >= int('0x03000000', 0):
found = v
if not found:
defenv['VER_PACKED'] = '0x%0.2i%0.3i%0.2i%0.1i' % (3, 3, 42, 0) # Default to a version number we never used
print('WARNING: VER_PACKED not set, defaulting to %s!' % defenv['VER_PACKED'])
At this point, I'm not sure if there is a dependency I'm missing or if this is an issue with the build script and needs to be reported at the NSIS issue tracker. Ideas?
-UPDATE 1-
Based on suggestions from #Anders, first I tried to build the head of the repo (r7132 trunk) instead of v3.0.4 using Python3. This got me farther but still failed on what appears to be Python2 vs 3 syntax errors in mstoolkit.py (might be a symptom of another issue rather than the cause though). I didn't investigate this too much further yet.
So next, I went back to Python 2.7. This got me further but the mstoolkit.py appears to be dependent on VS2003 implementation. I duplicated the VCToolkitInstallDir environment variable on my machine using the contents of the VS110COMNTOOLS (C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools) but that fails also:
File "C:\Source\IQClient_Interim\Shared\third_party\nsis\nsis-code-r7132-NSIS-tags-v304\SCons\Tools\mstoolkit.py", line 87, in get_msvctoolkit_paths
raise SCons.Errors.InternalError, "The Platform SDK directory was not found in the registry or in the `MSSdk` environment variable."
InternalError: The Platform SDK directory was not found in the registry or in the `MSSdk` environment variable.
I don't know what the VS2003 VCToolkitInstallDir ENVVAR was pointing to to fix this.
With all that said, I just noticed that Anders said that I might also have to use an older version of scons as well with python2.7 so I suppose I'll spend some time investigating that (along with looking into #bdbaddog's solution).
-UPDATE 2-
it was the mstoolkit directive (see #Anders answer's comments)
I got it working after that while using py 2.7 for NSIS 3.0.4.
Now on to x64 build but that's a different story so I'll post a different question.
NSIS v3.04 does not support Python 3, you have to grab the latest source code from SVN. v3.05 is coming out soon with support for Python 3.
VS2012 is old enough that you should be able to use Python 2.7 and a older version of SCons as an alternative.
As a final alternative, you can try to apply this diff to v3.04.
The issue you're running into is twofold.
Python > 3.0 strings are no longer bytes. They are unicode
SCons which supports Python > 3.0 (SCons >3.0 supports Python 2.7 and Python > 3.5.0)
In order to support this Node()'s (SCons's way of representing files, directories, and values which feed into a build) now have two methods get_contents() and get_text_contents().
Since you're using Python 3.8.0, get_contents() will return bytes, which explains the error you've received.
The proper way to resolve it is to change this line:
for v in re.compile(r'^\\H\{[v]?(\S+)\}', re.M).finditer(File('#/Docs/src/history.but').get_contents()): # Try to parse the Halibut history file
to:
for v in re.compile(r'^\\H\{[v]?(\S+)\}', re.M).finditer(File('#/Docs/src/history.but').get_text_contents()): # Try to parse the Halibut history file
Please let me know if this doesn't resolve the issue.
Also, if you're willing to install Python 2.7 and reinstall SCons via
py -2.7 -mpip install scons
(Assuming you've install the py launcher when installing Python. Not sure if that's default with Python 3.8 and/or Python 2.7. If not then /python -m pip install scons. You might have to install pip as well. Once again not sure on the default for that.)
Then you can avoid changing the SConstruct file.
Hope this helps!

Mismatch between python3 version from command line and version in /usr/local/lib

When I start python3 in terminal, it runs python 3.6.5.
However, when I look in /usr/local/lib, I see python 3.7 and all it's site-packages.
Why is there a discrepancy? Shouldn't the version always match when I update? Does this matter?
The command which python will tell you the path to the executable that is being chosen. Use echo $PATH to see which directories are checked for files to run and in which order - this should help you to understand which file is being chosen and why.

NodeJS installation error on Oracle Linux

I'm trying to solve a problem with the Node js installation on an Oracle Linux server, where after decompress a .tar file and trying to install it, I got a syntax error; so i would like to know if some had similar problem and if can tell me how can i fix it.
here is the syntax error:
$ ./configure
File "./configure", line 511
o['default_configuration'] = 'Debug' if options.debug else 'Release'
^
SyntaxError: invalid syntax
Thank you in advantage.
I haven't had a problem building Node.js from source on Oracle Linux.
However I mostly use the pre-built binaries from nodejs.org.
I also use the Oracle Linux Software Collections Library version of Node.js, see:
https://blogs.oracle.com/linux/entry/technology_preview_available_for_oracle
and:
http://docs.oracle.com/cd/E37670_01/E59096/html/section_zlg_m3g_dq.html

Getting error in installing rpy2 on windows

I am trying to install rpy2 package and getting following error both with
C:\python27>easy_install rpy2
Searching for rpy2
Reading http://pypi.python.org/simple/rpy2/
Reading http://rpy.sourceforge.net
Best match: rpy2 2.3.3
Downloading http://pypi.python.org/packages/source/r/rpy2/rpy2-2.3.3.tar.gz#md5=6cd95eb70645577cb53198ef0a32395e
Processing rpy2-2.3.3.tar.gz
Running rpy2-2.3.3\setup.py -q bdist_egg --dist-dir c:\users\chetan~1\appdata\local\temp\easy_install-wfxip9\rpy2-2.3.3\egg-di
st-tmp-rrezfb
"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
Invalid substring
in string
C:\Python27\lib\site-packages\setuptools\command\easy_install.py:921: RuntimeWarning: tp_compare didn't return -1 or -2 for ex
ception
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
error: Setup script exited with Problem while running `"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags`
And when I try pip this is what I get
c:\Python27\Lib\site-packages\django\bin>pip install rpy2
Downloading/unpacking rpy2
Running setup.py egg_info for package rpy2
"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
Invalid substring
in string
Problem while running `"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags`
I spent a few days on this too... then I stumbled upon this thread, where a link is given: http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2
On this page you can find (amongst other useful things) a pre-compiled version of rpy2 for Windows, and for different versions of Python. It apparently only works for R 2.15.3, I did not try it with other versions.
The error
"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
is probably caused by the absence of unix like tools in windows. (you might also have had an error like
'sh' is not recognized as an internal or external command, operable program or batch file
I finally got it to work on windows 7 by installing Rtools and mingw compiler and changing the setup.py and unixccompiler.py file. See rpy2 install on windows 7
Also the error
%load_ext rmagic
RuntimeError("Unable to locate R.dll within %s" % RHOME)
is caused by rpy2 not able to find R.dll correctly in the code. You can add R_HOME environment variable as eg C:\Program Files\R\R-3.0.2 the outside folder (for details see the link).
Hope this helps..
Recently had to attempt to build this from source. Got the rpy2-2.2.2 version so I can use with with Python 2.6.6 on Oracle Linux.
The solution to getting this to work was to fix a couple of things in the setup.py script.
First, allow get_rconfig() to allow empty strings. If there was a way to flag this, it wasn't obvious to me:
config = RConfig()
for about in ('--ldflags', '--cppflags',
'LAPACK_LIBS', 'BLAS_LIBS'):
#config += get_rconfig(r_home, about)
config += get_rconfig(r_home, about, allow_empty = True)
Secondly, fix a bug with the dropthrough in RConfig.from_string, where it was referencing a non-existent variable:
elif rconfig_m is None:
if allow_empty:
#if allow_empty and (rconfig == ''):
print(cmd + '\nreturned an empty string.\n')
This then allows the R CMD config loops to get parsed and the empty cases (which you will probably encounter if your R build was not built as a shared library) and I am able to complete the cycle with
python setup.py build install

Resources