diff --git a/dimod/sampleset.py b/dimod/sampleset.py
index 88d837e9..b5a23cc0 100644
--- a/dimod/sampleset.py
+++ b/dimod/sampleset.py
@@ -119,6 +119,13 @@ def as_samples(samples_like, dtype=None):
 
         return samples, labels
 
+    # if no ` is specified and the array_like doesn't already have a dtype, we default to int8
+    if dtype is None and not hasattr(samples_like, 'dtype'):
+        dtype = np.int8
+
+    if len(samples_like) == 0:
+        return np.empty((0, 0), dtype=dtype), []
+
     if isinstance(samples_like, Mapping):
         return as_samples([samples_like], dtype=dtype)
 
@@ -128,10 +135,6 @@ def as_samples(samples_like, dtype=None):
 
     # anything else should be array_like, which covers ndarrays, lists of lists, etc
 
-    # if no ` is specified and the array_like doesn't already have a dtype, we default to int8
-    if dtype is None and not hasattr(samples_like, 'dtype'):
-        dtype = np.int8
-
     try:
         samples_like = np.asarray(samples_like, dtype=dtype)
     except (ValueError, TypeError):

Can't create empty SampleSet with from_samples
We can get an empty `Response`:
```
>>> dimod.Response.from_samples([], {'energy': []}, info={}, vartype=bqm.vartype)
Response(rec.array([],
          dtype=[('sample', 'i1', (0,)), ('energy', '<f8'), ('num_occurrences', '<f8')]), [], {}, 'SPIN')
```
but not an empty `SampleSet`:
```
>>> dimod.SampleSet.from_samples([], energy=[], vartype=bqm.vartype)
Traceback (most recent call last):
    ...
    first_sample = next(itersamples)
StopIteration
```
diff --git a/tests/test_sampleset.py b/tests/test_sampleset.py
index 0766ee76..bf2d23af 100644
--- a/tests/test_sampleset.py
+++ b/tests/test_sampleset.py
@@ -108,6 +108,14 @@ class TestSampleSet(unittest.TestCase):
 
         self.assertEqual(len(list(ss.samples(n=1))), 1)
 
+    def test_from_samples_empty(self):
+
+        self.assertEqual(len(dimod.SampleSet.from_samples([], dimod.SPIN, energy=[], a=1)), 0)
+
+        self.assertEqual(len(dimod.SampleSet.from_samples({}, dimod.SPIN, energy=[], a=1)), 0)
+
+        self.assertEqual(len(dimod.SampleSet.from_samples(np.empty((0, 0)), dimod.SPIN, energy=[], a=1)), 0)
+
 
 class TestSampleSetSerialization(unittest.TestCase):
 

pip install -e .[all]
parse_log_pytest
requirements.txt
pytest coverage
apt-get update apt-get install -y libboost-dev
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
Cython==3.0.12
decorator==5.1.1
-e git+https://github.com/dwavesystems/dimod.git@63d9efac1c553e86c2cab6554d0af1ab3188b3c7#egg=dimod
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
jsonschema==2.6.0
mock==2.0.0
networkx==2.0
numpy==1.15.0
packaging==21.3
pandas==0.22.0
pbr==6.1.1
pluggy==1.0.0
py==1.11.0
pymongo==3.7.1
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.27.1
six==1.11.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0

name: dimod
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - charset-normalizer==2.0.12
      - codecov==2.1.13
      - coverage==6.2
      - cython==3.0.12
      - decorator==5.1.1
      - idna==3.10
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - jsonschema==2.6.0
      - mock==2.0.0
      - networkx==2.0
      - numpy==1.15.0
      - packaging==21.3
      - pandas==0.22.0
      - pbr==6.1.1
      - pluggy==1.0.0
      - py==1.11.0
      - pymongo==3.7.1
      - pyparsing==3.1.4
      - pytest==7.0.1
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - requests==2.27.1
      - six==1.11.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zipp==3.6.0
prefix: /opt/conda/envs/dimod

tests/test_sampleset.py::TestSampleSet::test_from_samples_empty
tests/test_sampleset.py::TestSampleSet::test_eq_ordered tests/test_sampleset.py::TestSampleSet::test_from_samples tests/test_sampleset.py::TestSampleSet::test_from_samples_fields_multiple tests/test_sampleset.py::TestSampleSet::test_from_samples_fields_single tests/test_sampleset.py::TestSampleSet::test_from_samples_iterator tests/test_sampleset.py::TestSampleSet::test_from_samples_single_sample tests/test_sampleset.py::TestSampleSet::test_from_samples_str_labels tests/test_sampleset.py::TestSampleSet::test_mismatched_shapes tests/test_sampleset.py::TestSampleSet::test_shorter_samples tests/test_sampleset.py::TestSampleSetSerialization::test_functional_json tests/test_sampleset.py::TestSampleSetSerialization::test_functional_simple_shapes tests/test_sampleset.py::TestSampleSetSerialization::test_functional_str
dimod/sampleset.py
dimod/sampleset.py